Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to list symbols in object file

📅 2014-Aug-07 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ nm, object file, symbols ⬩ 📚 Archive

nm is a very useful command for programmers. It can be used to list the symbols defined in an executable, object file (.o) or shared object library file (.so).

I typically need this command when the compiler throws me a undefined reference error. By searching for the reference symbol among the symbols exported by a library file, I can figure out if that is the one that needs to be linked into the target executable.

$ nm -g

Other options that I find useful:

Tried with: binutils 2.24 and Ubuntu 14.04

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧