This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Weak references, --as-needed, and pthreads
>> (7) When ld.so binds a symbol with no version information, it does not
>> bind to the default version; instead it binds to the older version
>> (not sure if that's by chance or it it deliberately picks the first or
>> oldest version).
>
> In general, it really must pick the base version for the symbol because the
> binary could have been produced before symbol versioning was introduced for
> this particular library.
>
> In particular, a reference (weak or strong) to any glibc symbol really must
> have an attached symbol version, especially if a weak function symbol is
> actually used to call the function, otherwise the binary is invalid and
> might fail to work with any future glibc update.
Makes sense. But what do I do if the library with the definition is
not needed? Should I keep the version info anyway? Alan's comment from
the original patch said:
> Not quite so simple as just testing
> whether the reference is strong before setting is_needed, since we
> can't have symbol versions coming from a non-loaded shared lib. If
> you do, ld.so segfaults.
But that was five years ago -- is that still a problem with ld.so?
I'm thinking that if I do end up discarding the version info because
it was derived from a non-needed library, I should at least print a
warning.
-cary