This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld: autoselecting bfd based on input objects
- From: Ian Lance Taylor <iant at google dot com>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Wed, 23 Apr 2008 12:23:25 -0700
- Subject: Re: ld: autoselecting bfd based on input objects
- References: <200804231454.36960.vapier@gentoo.org>
Mike Frysinger <vapier@gentoo.org> writes:
> From looking at a few targets, i dont think anyone does this, or i just missed
> it. is it possible for ld to check the incoming elf objects and select an
> appropriate bfd target before it's too late ? in the Blackfin case, we
> distinguish object formats using ELF flags, so we know which bfd is
> appropriate as soon as we read the ELF header ...
It is possible in principle, but there is no actual support for it.
GNU ld has a default target, typically specified by the linker script,
and that is the target which it will generate. If the inputs have a
different format, it will still do the link, but the input file
formats won't affect the output format.
gold works differently. It sets the format of the output file based
on the format of the input files. Unlike GNU ld, gold refuses to link
an input file which has a different format from the output file, with
the exception of files for which -b binary is in effect.
Ian