This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix objcopy PE -> ELF conversion


Daniel Jacobowitz wrote:
On Mon, Oct 22, 2007 at 09:02:39PM +0200, Christian Franke wrote:
Objcopy cannot convert pe-i386 to elf32-i386. The offsets of the pc-relative relocation entries are not converted properly.
(http://sourceware.org/bugzilla/show_bug.cgi?id=970)

As HJ said, this should be done in BFD, not in objcopy.c. Maybe the generic BFD_RELOC_32_PCREL should not be used for the slightly different PE semantics? That'd prevent BFD making the conversion.


Another alternative would be to keep BFD_RELOC_32_PCREL and let bfd_canonicalize_reloc() return arelent.addend = -4 for these entries.
Then the backend can detect the nonzero addend and fail for variants without addend in the symbol table (or better fixup section data later to support the conversion :-). But apparently the ELF-backend simply ignores the addend in this case.


The -4 offset is hard-coded in the COFF_WITH_PE part, therefore it might be very complex to fix this in BFD.

I probably better provide a separate conversion utility to build GRUB2 modules on Cygwin :-)

Christian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]