This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
ambiguous file formats coff-x86_64 / pe-x86_64
- From: "Jan Beulich" <JBeulich at suse dot com>
- To: <binutils at sourceware dot org>
- Date: Thu, 22 Dec 2016 07:43:39 -0700
- Subject: ambiguous file formats coff-x86_64 / pe-x86_64
- Authentication-results: sourceware.org; auth=none
Hello,
in the Xen Project we've recently switched to linking in a trivial COFF
object to trigger the COFF/PE build ID machinery when building an EFI
binary. We've now had reports that on binutils with both coff-x86_64
and pe-x86_64 configured in (but defaulting to ELF), linking fails due
to the object being ambiguous. Afaict (from going through config.bfd)
it is not safe to force the object type to either of the two types, as
each of the two could be unavailable in a particular binutils build (the
only requirement is pei-x86_64 to be available, which different
targets select together with one or the other).
Are there ways to cleanly deal with this situation? Is there perhaps
a way to tell the linker to prefer one format when both are available?
The object file contains no sections or symbols, and hence it is -
afaict - completely benign which of the two formats it would get
handled with.
I'd like to avoid the uglier approach of scanning the list of
supported targets from the help output of one of the tools, or
trying one and falling back to the other if the first fails ...
Thanks, Jan