binutils: Not all default linker targets are built on x86_64
On x86_64, Alpine's binutils ld and ld.gold binaries do not support all targets that are otherwise available on other architectures. This prevents cross-compilation/linking for ARM, s390, etc.,
To verify, compare the output of the following commands on x86_64 versus other platforms (aarch64, for example)
ld --help | grep supported
ld.gold --help | grep supported
You will see that on x86_64, only some x86_64 and i386 targets are present.
This is caused by commit 1e88af3f, which added --enable-targets=x86_64-pep
conditionally on x86_64 only, to support cross-compiling for i386pep
(needed by Xen)
I don't have a good solution other than setting --enable-targets=all
for all platforms. This however increases the binary size of ld
by a few megabytes (not so for ld.gold
, though).
Maybe we can at least build ld.gold
separately with all targets enabled?
Alternatively, could we build a ld
variant for that Xen use case?