ld: autoselecting bfd based on input objects

Mike Frysinger vapier@gentoo.org
Wed Apr 23 20:58:00 GMT 2008

On Wednesday 23 April 2008, Ian Lance Taylor wrote:
> 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.

more just curiousness and streamlining of things for Blackfin ... not a real 
need.  this plus Daniel's feedback says that it's much more of a hassle today 
than it's worth [to me] to do with GNU ld.  maybe at some point we'll take a 
look at Blackfin/gold, but not anytime remotely soon (it certainly has 
sounded promising).

the Blackfin bfds will check the ELF header to make sure that the incoming 
objects match the bfd and if they dont, you'll get an appropriate error about 
mixing object formats.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/binutils/attachments/20080423/1b526f8e/attachment.sig>

More information about the Binutils mailing list