Name

nm

Synopsis

    nm [options]objfiles

Print the symbol table (name list) in alphabetical order for one or more object files (usually ELF or COFF files), shared or static libraries, or binary executable programs. Output includes each symbol’s value, type, size, name, etc. A key letter categorizing the symbol can also be displayed. You must supply at least one object file.

On Solaris, nm is in /usr/ccs/bin and /usr/xpg4/bin.

Common Options

-A, --print-file-name

Write the full pathname or library name on each line.

-g, --extern-only

Write only external (global) symbol information.

-P, --portability

Print output in the POSIX portable format.

-tradix, --radix=radix

Write numeric values in the specified radix : d for decimal, o for octal, and x for hexadecimal.

-u, --undefined-only

Report only the undefined symbols.

Solaris and GNU/Linux Options

-C, --demangle[=style]

Print demangled C++ symbol names. GNU/Linux lets you supply the appropriate demangling style.

-D, --dynamic

Print dynamic, not normal, symbols. Useful only when working with dynamic objects (some kinds of shared libraries, for example).

-V, --version

Print nm’s version number on standard error.

GNU/Linux and Mac OS X Options

-a, --debug-syms

Print debugger symbols.

-n, --numeric-sort

Sort the external symbols numerically, not by name.

-p, --no-sort

Don’t sort the symbols; print them in the order they are found in the object file.

-r, --reverse-sort

Sort in reverse order.

Solaris Options

-e

Report only external and static symbols; obsolete.

-f

Report all ...

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.