ld's targets vs emulations (intending to link EFI binaries on Linux)
Tue May 10 16:28:00 GMT 2011
> 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.
More information about the Binutils