bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/3732] strip breaks mixed msvc++ (with manifest) and gcc (w


From: angustia at arrozcru dot no-ip dot org
Subject: [Bug binutils/3732] strip breaks mixed msvc++ (with manifest) and gcc (with debug) generated pei-i386
Date: 19 Dec 2006 17:10:36 -0000

------- Additional Comments From angustia at arrozcru dot no-ip dot org  
2006-12-19 17:10 -------
Subject:  New: strip breaks mixed msvc++ (with manifest)
 and gcc (with debug) generated pei-i386

After running the file with wine, I came closer to the problem. 
Specifically reading around 
http://source.winehq.org/source/dlls/ntdll/virtual.c#L1068

gmmain.exe (the original file with msvc++ manifest and gcc debug) had 
these sections:

Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000083b4  00401000  00401000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rdata        00001d0e  0040a000  0040a000  0000a000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .data         00001000  0040c000  0040c000  0000c000  2**4
                  CONTENTS, ALLOC, LOAD, DATA
  3 .stab         00000324  0040f000  0040f000  0000d000  2**2
                  CONTENTS, ALLOC, LOAD, DATA, DEBUGGING
  4 .stabstr      00000787  00410000  00410000  0000e000  2**0
                  CONTENTS, ALLOC, LOAD, DATA, DEBUGGING
  5 .rsrc         000001f8  00411000  00411000  0000f000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA

Strip removed .stab and .stabstr. That way, .rsrc was moved down the 
file. But the VirtualAddress value from .rsrc's IMAGE_SECTION_HEADER was 
not updated, and that lead to the error. PointerToRawData was, though.

I looked for other programs to strip pei-i386 executables. I came 
accross PE Explorer, in which I can remove some sections and re-save the 
file. Whenever I remove a section, it asks me "Number of sections has 
been changed. Update NumberOfSections and recalculate SizeOfImage?".

It seems to me that the sections headers need to and can safely be 
updated. I don't know if it's possible to come accross a file in which 
the VirtualAddress value can't be changed. I really don't know much 
about executable file formats.

Anyways, after I remove .stab and .stabstr with PE Explorer, and run 
binutils' strip on the output file (which I named gmmain2.exe), it works 
alright, and the size is exactly the same as if I had run strip on the 
original file, with debug information. Here is their objdump -h.

gmmain2.exe:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000083b4  00401000  00401000  00000400  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rdata        00001d0e  0040a000  0040a000  00008800  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .data         00001000  0040c000  0040c000  0000a600  2**4
                  CONTENTS, ALLOC, LOAD, DATA
  3 .rsrc         000001f8  0040f000  0040f000  0000b600  2**2
                  CONTENTS, ALLOC, LOAD, DATA

gmsmain.exe:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000083b4  00401000  00401000  00000400  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rdata        00001d0e  0040a000  0040a000  00008800  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .data         00001000  0040c000  0040c000  0000a600  2**4
                  CONTENTS, ALLOC, LOAD, DATA
  3 .rsrc         000001f8  00411000  00411000  0000b600  2**2
                  CONTENTS, ALLOC, LOAD, DATA

You can find both files here (gmsmain.exe is the same as in the other 
tarball. gmmain2.exe is the working file).
http://arrozcru.no-ip.org/stripped_files.tar.gz

Ramiro Polla


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3732

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]