ld's targets vs emulations (intending to link EFI binaries on Linux)

Nick Clifton nickc@redhat.com
Tue May 10 16:28:00 GMT 2011


Hi Jan,

> What is the point of ld supporting (in e.g. the default x86 Linux
> configurations) PE executables as targets, but not as emulations?
> This basically means that one can link such executables, but there's
> no control over the various linking parameters (as those are
> processed by the respective [not present] emulation code).

Essentially this is because it is easier this way.  Supporting multiple, 
dissimilar emulations would make the linker a lot more complex.

Changing the output format is actually a problematic feature of the 
linker, and one that is disabled for some architectures.  It is much 
cleaner to link without changing format and then use objcopy to convert 
the resulting binary.  You are correct however in saying that objcopy 
will not convert relocations and this is actually one of the big 
problems with format conversions - there is rarely a good mapping 
between the relocations of the formats.

Cheers
   Nick



More information about the Binutils mailing list