http://sourceware.org/bugzilla/show_bug.cgi?id=12807
--- Comment #2 from Emil <ee at la dot mine.nu> 2011-05-27 01:23:12 UTC --- (In reply to comment #0) > objcopy decides to change the R_386_32 type into type "1" - 16 bits > (instead of "6" - 32 bits). The PE format doesn't handle 16 bit relocations > so when you link the copied object into a program and run it you'll get a > segfault because the "str" pointer is null. > No error or warning is displayed by objcopy. Actually there are more bugs: R_386_32 converts to type "1" R_386_PC32 converts to type "2" "Microsoft Portable Executable and Common Object File Format Specification" Revision 8.2 states that types "1" and "2" are not supported. The correct transformation is R_386_32 to IMAGE_REL_I386_DIR32 (type 6) R_386_PC32 to IMAGE_REL_I386_REL32 (type 20) Beside the above changes symbols of the last relocation type (which covers branch and call instructions) should have symbol_type = 0x20 (now it is 0) Another bug is that the actual relative displacement is 4 bytes off. I have attached a little C program which patches COFF pe-i386 files produced by OBJCOPY so they are now linking correctly and the linker generates working EXE files. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils