I’d like to list the symbols a program loads from a specific library. You can list the needed libraries with ldd:
ldd -v myExecutable
This gives something like the following output:
libgcc_s.so.1 (GCC_3.0) => /lib/i386-linux-gnu/libgcc_s.so.1
libc.so.6 (GLIBC_2.1) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.11) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6
Now I’d like to know which symbols are loaded from which library. Specifically, in my case I’d like to find those that are loaded from GLIBC_2.11 and eventually get rid of them.
(I’m already using ligcc to avoid linking against new symbols – now I’d like to see which symbols are not available before 2.11)
nmmight satisfy what you’re after. Just used it on my executable, and it does give versions of the library along with the symbol. eg:so you could do a grep to find only the version you’re interested in.