gold patch committed: Skip incompatible objects

Michael Hennebry
Mon Mar 16 20:02:00 GMT 2009

On Mon, 16 Mar 2009, Ian Lance Taylor wrote:

> 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.  ...

Hindsight is 20/20.
Red smears seem more significant after one
has discovered a deathly pale corpse.

> ...                          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.

Or I don't pick up either and it fails to link.
There are only two missing symbols, so I suspect API version mismatch.
After a week or two of wild goose-chasing, I discover one rather small
archive sitting all alone in the one directory that wasn't spelled correctly.
If the linker finds a deathly pale corpse (unlinkable files),
it would be nice if it told me about the red smears
(non-existant directories) it noticed earlier.

> 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.

Perhaps it could be implied by --verbose.

"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."

More information about the Binutils mailing list