It's well known that glibc (and, as far as I know, glibstd++ also) uses symbol versioning mechanism. (For the details refer: How can I link to a specific glibc version.)
The question is how to determine exact versions of GLIBC and GLIBCX开发者_如何学JAVAX will be chosen by linker for names from libc and libstdc++? For example, how to get something like this:
time -> time@GLIBC_2_5
...
gethostbyname -> gethostbyname@GLIBC_2_3
Why do we need this? It seems to me that it can be useful if you want to minimize required versions of glibc/libstdc++.
One thing you can try is running objdump -T
on your binary. For example, here's how to see that the /usr/sbin/nordvpnd
binary on my system depends on GLIBC version at least 2.18:
$ objdump -T /usr/sbin/nordvpnd | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
2.2.5
2.3
2.3.2
2.3.3
2.3.4
2.4
2.7
2.8
2.9
2.10
2.14
2.15
2.16
2.17
2.18
If you are considering linking to older versions of symbols, be aware that these older versions may depend on older, different structures or other definitions as well. To avoid this, compile and link with older, matching header files and libraries.
精彩评论