28

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.

50

It's probably got its regular symbols stripped and what's left is its dynamic symbols, which you can get with nm -D.

10

@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.

0

Find out if it is a shared object, or, a regular ASCII file. If it is a shared object you should see "ELF 32-bit LSB shared object,"

file /lib/i386-linux-gnu/libc.so.6
  • libc.so.6 is oviously a shared object. – Gilles May 11 '16 at 22:24
  • I 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. – jncc99 May 11 '16 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.