Our binutils is setup to have some conflicts. This is Xen from git. [ebuild R ] sys-devel/binutils-2.25.1-r1:2.25.1::gentoo USE="cxx multitarget nls zlib -static-libs {-test} -vanilla" ld -mi386pep --subsystem=10 --image-base=0xffff82d080000000 --stack=0,0 --heap=0,0 --strip-debug --section-alignment=0x200000 --file-alignment=0x20 --major-image-version=4 --minor-image-version=9 --major-os-version=2 --minor-os-version=0 --major-subsystem-version=2 --minor-subsystem-version=0 --build-id=sha1 -T efi.lds -N prelink-efi.o efi/relocs-dummy.o /home/cardoe/work/xen/xen/common/symbols-dummy.o efi/buildid.o -o /home/cardoe/work/xen/xen/.xen.efi.0xffff82d080000000.0 && ld -mi386pep --subsystem=10 --image-base=0xffff82d0c0000000 --stack=0,0 --heap=0,0 --strip-debug --section-alignment=0x200000 --file-alignment=0x20 --major-image-version=4 --minor-image-version=9 --major-os-version=2 --minor-os-version=0 --major-subsystem-version=2 --minor-subsystem-version=0 --build-id=sha1 -T efi.lds -N prelink-efi.o efi/relocs-dummy.o /home/cardoe/work/xen/xen/common/symbols-dummy.o efi/buildid.o -o /home/cardoe/work/xen/xen/.xen.efi.0xffff82d0c0000000.0 && : efi/buildid.o: file not recognized: File format is ambiguous efi/buildid.o: matching formats: coff-x86-64 pe-x86-64 Here's the Xen EFI maintainer requesting some info from the binutils maintainers: https://sourceware.org/ml/binutils/2016-12/msg00374.html Here's the thread on the Xen mailing list about it: https://lists.xenproject.org/archives/html/xen-devel/2016-12/msg00799.html The maintainer suggested a change to how we build binutils: https://lists.xenproject.org/archives/html/xen-devel/2017-01/msg00404.html
I can't reproduce this. Basically I only get `ld -melf_x86_64 ...` and `ld -melf_i386 ...` on my ABI="amd64 x86" system. These seem to be driven by XEN_TARGET_ARCH=x86_64 and x86_32. The build system selects makefile rules from config/x86_64.mk and config/x86_32.mk which set LDFLAGS_DIRECT fed to ld. But I didn't really dig any deeper to figure out how these are detected. However, I'm pretty sure there's nothing to fix in binutils.
you've built with USE=multitarget which means you have a linker that supports all possible emulations. if XEN can't figure out how to pass a proper -m flag to ld, there isn't much we can do about it. you can always try building w/out USE=multitarget.