bug-binutils
[Top][All Lists]
Advanced

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

bug: stripping PEF files leaves relocs against removed sections


From: Sterling Augustine
Subject: bug: stripping PEF files leaves relocs against removed sections
Date: Mon, 02 Feb 2004 16:21:35 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021017

Hello, there appears to be a bug in strip when stripping dlls in the PEF format.

I first found this bug in strip with binutils 2.11, but have downloaded the latest snapshot and it still appears.

I have reproduced this bug with the binutils configured to target both mingw32 and cygwin. Here is how to reproduce it under cygwin.

1. gcc -g -c hello.c
2. dllwrap hello.o -o hello.dll
3. I cannot get objdump to interpret the contents of the .reloc section. Perhaps you know how. In any event, the microsoft tool "dumpbin /RELOCATIONS /HEADERS hello.dll" will interpret the contents of the .reloc section and the show the section headers.

Note the VMA of the .stabs section is 6000 and that there are relocations starting at that address:

...
SECTION HEADER #6
   .stab name
     8DC virtual size
    6000 virtual address
     A00 size of raw data
     E00 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
...

...
    6000 RVA,       18 SizeOfBlock
      14 HIGHLOW
      20 HIGHLOW
     110 HIGHLOW
     164 HIGHLOW
     17C HIGHLOW
     188 HIGHLOW
     8FC HIGHLOW
       0 ABS
...


4. Use strip to strip the executable
5. Repeat step 3. Now there is no .stabs section--which is correct. But the relocations starting at 6000 RVA are still there. In fact, the .reloc section hasn't changed size at all.

For dlls this causes serious problems. If the OS decides to dynamically rebase a stripped dll, it will fail in very strange ways, most often with the cryptic error message "The application foo failed to initialize correctly. 0xC0000005."

Curiously, linking with -s produces a correct executable, with no relocations against the nonexistent stabs sections. However, this isn't always a viable workaround.

Please let me know if you need any more information.

Thanks,

Sterling





reply via email to

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