gold patch committed: Skip incompatible objects

Ian Lance Taylor
Mon Mar 16 17:44:00 GMT 2009

Michael Hennebry <> writes:

> On Fri, 13 Mar 2009, Ian Lance Taylor wrote:
>> When the GNU linker searches for an input file or an archive, if it
>> finds an incompatible file, it skips it and keeps searching.  An object
>> is incompatible if it is built for a target other than the one being
>> linked.  An archive is incompatible if it contains an incompatible
>> object.  A script is incompatible if it uses an OUTPUT_FORMAT command to
>> name a target other than the one being linked.  The GNU linker issues a
>> warning when it skips a file, unless --no-warn-search-mismatch is used.
> IIRC linkers generally and GNU's in particular
> *quietly* skip -L directories they can't find.
> Usually that isn't too bad.
> Sometimes it's the reason a failure to link is mysterious to me.
> It would be nice if, at least in the case of a failure to link,
> a failure to find a directory became noisy.

It seems a little bit peculiar to me to go back and warn only after
reporting some other error.  The only time that an incorrect -L option
would be a problem in this way would be if you have multiple libraries
with the same name, and you are picking up the wrong one because a -L
option was missed.  That does not seem like a common case to me.

I wouldn't object to optionally warning about missing -L directories,
but I don't think it should be the default behaviour, and I doubt I will
bother to write such a patch myself.


More information about the Binutils mailing list