I'm trying to implement symbol resolution for my check-link-consistency tool (analog of Gentoo's revdep-rebuild, but for Arch).
There are no symbols with bind=STB_LOCAL on my system (desktop Artix), but about 12% (381522) with versym=VER_NDX_LOCAL; the most of them (379189) are in section=SHN_UNDEF.
Most of these "local undefined" symbols -- but not all! -- are actually resolved by other libraries. Common pattern is that local symbols in /usr/lib/xxx/.../*.so actually reference global symbols in /usr/lib/xxx.so (and in its NEEDED libraries, and sometimes in other dynamically loaded libraries). I assume these /usr/lib/xxx/.../*.so are loaded dynamically using dlopen() by /usr/lib/xxx.so as plugins.
To ensure there are no orphan symbols on the system, I can specify that /usr/lib/xxx.so is NEEDED lib for all /usr/lib/xxx/.../*.so via my tool's config file:
addLib=/usr/lib/bash/** /usr/bin/bash
addLib=/usr/lib/hwloc/** /usr/lib/libhwloc.so
...
addLib=/usr/lib/xorg/modules/** /usr/lib/Xorg
(** means "including subdirectories", i.e. last line applies to modules/drivers too.) Currenly my config has 60 such lines.
The problem is that 50 such "local undefined" symbols don't reference anything (I cannot find corresponding exported symbol on the system), yet they are in section=SHN_UNDEF and they don't differ from "resolvable" local symbols in any other way I was able to check. Most of them are in nVidia blob /usr/lib/xorg/modules/drivers/nvidia_drv.so:
mi* symbols are resolved to /usr/lib/Xorg (e.g. miPolyRectangle);miRegionCreate).I was told these orphan symbols are long removed from X11 lib and now are inline, but how can I tell them from those I should resolve? How loader distinguishes them? Or if it does not, meaning it just silently ignores "local undefined" symbols it could not resolve (which is totally weird), then I should too -- thus leaving 12% of symbols on the system unchecked (and ending up with much smaller config file, speaking of the bright side). And might be practically irrelevant, but for better understanding: why these inline symbols are in DYNSYM section at all?
Thanks for reading thus far. :)