GNOME's new versioning scheme
GNOME's new versioning scheme
Posted Sep 19, 2020 1:15 UTC (Sat) by mathstuf (subscriber, #69389)In reply to: GNOME's new versioning scheme by nix
Parent article: GNOME's new versioning scheme
And yes, embedding libraries is a real pain. We do it because we have Windows and macOS deployments and who is going to have a viable HDF5 SDK just laying around there? No one, that's who. But I make sure that every library name, header file, and exported symbol is mangled to avoid conflicts. Sometimes static globals still bite us, but those errors usually have the symbol name in them so we can go and fix it. We don't mangle data types because no one should be including our mangled library and a real one in the same TU anyways. Alas, Python module paths/names are also nigh impossible to mangle in practice, so we do end up colliding there, but AFAIK, there's nothing we can do about that.
Posted Sep 19, 2020 11:40 UTC (Sat)
by nix (subscriber, #2304)
[Link] (5 responses)
Posted Sep 19, 2020 18:46 UTC (Sat)
by mathstuf (subscriber, #69389)
[Link] (4 responses)
- -Bsymbolic: don't look for symbols we know are in our own library anywhere else
Posted Sep 19, 2020 19:24 UTC (Sat)
by nix (subscriber, #2304)
[Link] (3 responses)
DF_GROUP (as usual I got this one wrong, it's a flag, not a tag) constrains symbol searches from within this library to happen only within the library and its transitive DT_NEEDED libraries: it stops global symbols or symbols in other branches of the search tree from interposing. The relevant ld flag to look for is '-Bgroup'. It is *not* the same as --start-group/--end-group or the linker script GROUP command: fairly confusing naming really. Weak symbols still work, but only if they're resolved by objects loaded by this shared library or things it loaded. (So the old pthreads trick wouldn't work, not that it's a good idea anyway in glibc 2.32+.)
Posted Sep 22, 2020 16:33 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link] (2 responses)
I have a PR (that's likely fallen on deaf ears) for macOS' linker to have a "any symbol you find in this library should be looked up at runtime" behavior which is, I think, exactly the kind of behavior I'd like. https://github.com/apple-opensource/ld64/pull/1
For reference, the search term to use for the ELF flag is `DF_1_GROUP`.
Posted Sep 22, 2020 21:38 UTC (Tue)
by nix (subscriber, #2304)
[Link] (1 responses)
Posted Sep 22, 2020 21:54 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link]
GNOME's new versioning scheme
GNOME's new versioning scheme
So this doesn't seem like it would help with other code using my symbols from getting confused. Do you have documentation links for DT_GROUP? My manpages have nothing about it. From your descriptions, it sounds like it restricts symbol lookups to those found via DT_NEEDED for the library itself? So basically, a better `RTLD_LOCAL`. How does this interact with weak symbols (like, say, Anaconda where libpython.so symbols are meant to be provided by the loading executable)?
GNOME's new versioning scheme
GNOME's new versioning scheme
GNOME's new versioning scheme
GNOME's new versioning scheme