Quiz Entry - updated: 2026.07.10
What command shows the symbols in an object file?
readelf -s or nm lists an object's symbols — names, types, and whether each is defined (T/D/B) or undefined (U).
$ readelf -s main.o
Symbol table '.symtab' contains 9 entries:
Num: Size Type Bind Ndx Name
4: 8 OBJECT GLOBAL 3 buf
5: 83 FUNC GLOBAL 1 main
8: 0 NOTYPE GLOBAL UND swap
$ nm main.o
0000000000000000 D buf
0000000000000000 T main
U swap
nm symbol types:
T- text section (code)D- initialized data sectionB- BSS (uninitialized data)U- undefined (external reference)- Lowercase = local, Uppercase = global
For shared libraries, also use:
# Dynamic symbols
$ objdump -T libc.so.6 | grep malloc
# Dynamic section
$ readelf -d executable
Go deeper:
nm(1) — symbol type codes — the full table behind
T/D/B/Uand the local-vs-global case rule.