This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 06/13/2018 06:57 PM, Cary Coutant wrote:
(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?
Yes, and it should emit a weak version, so that loading of the library with the weak reference is not rejected if the referenced library does not provide that symbol version.
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 not aware of any segfaults, and I couldn't find any defaults. Weak versions are however a bit obscure, and perhaps they are not implemented correctly. I'm not even sure if we have any tests for this functionality; it's kind of hard to spot this by reading sources.
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.
I'm still not sure that discarding a version that is known to be needed at run time is the right thing to do.
Thanks, Florian
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |