Why nm shows no symbols for /lib/i386-linux-gnu/libc.so.6?
Solution 1
It's probably got its regular symbols stripped and what's left is its dynamic symbols, which you can get with nm -D
.
Solution 2
@PSkocik answered this. I just want to add more detail. There are two kinds of symbol sections in ELF: .symtab
and .dynsym
(see the Linux Standard Base Core Specification, a.k.a. LSB_5.0.0, for details). .symtab
is for the linking step of the shared lib itself. Once linking is finished, the .symtab
section is not needed anymore. The .dynsym
section contains important symbols that are supposed to be searched by the dynamic linker at run time. nm
by default only dumps symbols in the .symtab
section.
LSB_5.0.0 Section 10.2.2.1, “ELF Section Types”, says a conforming shared lib should have either .symtab
or .dynsym
but not both. As part of the ABI library, libc is stripped out of the .symtab
to be spec conforming.
Related videos on Youtube
masec
Updated on September 18, 2022Comments
-
masec over 1 year
I expected to see number of symbols in the libc.so.6 file including printf. I used the nm tool to find them, however it says there is no symbol in libc.so.6.
-
Gilles 'SO- stop being evil' almost 8 years
libc.so.6
is oviously a shared object. -
jncc99 almost 8 yearsI never assume in a Linux environment. Considering someone could have touched the root directories. Yes, by name it is obviously a share object. And, it doesn't hurt to verify; when you are not getting the expected output.