Hi Dave,

   I think there's a bug in the way objcopy handles R_386_32 (absolute
32-bit) relocation entries when translating from elf to pe-i386
(windows) object files.


The symptom is that R_386_32 relocations in elf get translated into
DIR16 entries in the pe-i386. (Or perhaps just not translated, since I
think DIR16 is numerical value 1, which I think is the same numerical
value as R_386_REL, and possibly also the same value as bfd uses
internally, though that part is pure speculation from a very quick
look at the source.)

Your speculation is correct. Objcopy does not perform *any* translation of relocations. This is why it very rarely works when translating object files. Your best bet is to link the elf32-i386 object files into a fully linked program first and then use objcopy to translate it into a pe-i386 executable. (But beware of shared libraries/DLLs. Objcopy will not translate between uses of shared library functions and uses of DLL functions either).

Cheers
  Nick


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to