[PATCH] fix objcopy PE -> ELF conversion

Christian Franke Christian.Franke@t-online.de
Mon Oct 22 22:31:00 GMT 2007


H.J. Lu wrote:
>>>> ...   
>>>>         
>>> There is nothing wrong with objcopy. GRUB2 should be fixed instead.
>>>  
>>>       
>> The ELF loader of GRUB2 is IMO OK.
>>
>> "objcopy -O elf32-i386 pe-file.o elf-file.o" definitly produces bad 
>> pc-relative relocation with offset 4. There are some provisions in the 
>> BFD COFF_WITH_PE code to fix the offset later in the executable. But 
>> this has no effect when converting relocatable modules.
>>
>>     
>
> I don't think objcopy is designed to convert relocataions between
> different formats. If we really want to support it, it should
> be done in BFD.
>   

Agree. But objcopy should not produce broken output in this case. It 
should abort with an error message.

Christian



More information about the Binutils mailing list