I've built a simple program like this:
g++ application.cpp -o application.exe
and then executed the command;
ldd application.exe
...
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
...
I want to list all the symbols of the libc library:
nm /lib/x86_64-linux-gnu/libc.so.6
nm: /lib/x86_64-linux-gnu/libc.so.6: no symbols
nm --defined-only /lib/x86_64-linux-gnu/libc.so.6
nm: /lib/x86_64-linux-gnu/libc.so.6: no symbols
Why nm reports no symbols? If libc.so.6 is not a library, but a some kind of a link to the actual library, then how can I find the actual library?
The nm commands provides information on the symbols being used in an object file or executable file. The default information that the 'nm' command provides is : Virtual address of the symbol. A character which depicts the symbol type.
nm displays the symbol table that is associated with an object, archive library of objects, or executable files. By default, nm lists the symbols in file in alphabetical order by name and provides the following information about each: File or object name (if you specified -A). Symbol name.
Instead, they're just placed in an appropriate folder and used automatically by other programs via Linux's dynamic link loader. However, you might be able to read the SO file as a text file by opening it in a text editor like Leafpad, gedit, KWrite, or Geany if you're on Linux, or Notepad++ on Windows.
nm (name mangling) is a Unix command used to dump the symbol table and their attributes from a binary executable file (including libraries, compiled object modules, shared-object files, and standalone executables). The output from nm distinguishes between various symbol types.
By default, nm
reads the .symtab
section in ELF objects, which is optional in non-relocatable objects. With the -D
/--dynamic
option, you can instruct nm
to read the dynamic symbol table (which are the symbols actually used at run time). You may also want to use --with-symbol-versions
because glibc uses symbol versioning extensively.
Alternatively, you can use eu-readelf --symbols=.dynsym
or objdump -Tw
. (readelf -sDW
does not include symbol versioning information.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With