Reference

nm(1)

display name list (symbol table)

NAME

nm – display name list (symbol table)

SYNOPSIS

nm [-AaCDegnoPprsuw] [-t d|o|x] [file ...]

DESCRIPTION

The symbol table (name list) of each object in file(s) is displayed. If a library (archive) is given, nm displays a list for each object archive member. If file is not present, nm searches for the file a.out and displays its symbol table if it exists.

The options are as follows:

-A

Display the full path or library name of object on every line.

-a

Display symbol table entries inserted for use by debuggers.

-C

Decode low-level symbol names. This involves removing extra underscores and making C++ function names readable.

-D

Display the dynamic symbol table instead of the normal symbol table.

-e

Output extended information, that is `w' for weak symbols, `f' for function-like symbols, and `o' for object-like symbols.

-g

Restrict display to external (global) symbols.

-n

Present results in numerical order.

-o

Display the full path or library name of object on every line (this is similar to -A).

-P

Report information in POSIX format: full path or library name of object if either -A or -o has been specified; symbol name; symbol type; symbol value and size (unless the symbol is undefined). The radix of symbol values and sizes defaults to decimal, and may be changed with the -t option.

-p

Do not sort at all.

-r

Reverse order sort.

-s

Show archive index.

-t d|o|x

In POSIX format output, choose the numeric radix as follows:

d

Decimal.

o

Octal.

x

Hexadecimal.

-u

Display undefined symbols only.

-w

Warn about non-object archive members. Normally, nm will silently ignore all archive members which are not object files.

Each symbol name is preceded by its value (a blank field if the symbol is undefined) and one of the following letters:

-

debugger symbol table entries (see the -a option)

A

absolute

B

bss or tbss segment symbol

C

common symbol

D

data or tdata segment symbol

F

file name

R

read-only data segment symbol

T

text segment symbol

U

undefined

W

weak symbol

If the symbol is local (non-external), the type letter is in lower case. The output is sorted alphabetically.

SEE ALSO

ar(1), size(1), ar(5), elf(5)

STANDARDS

The nm utility is part of the IEEE Std 1003.1-2008 (“POSIX.1”) specification; this implementation is largely incompatible with that standard.

HISTORY

An nm command appeared in Version 1 AT&T UNIX.

History

- since OpenBSD 3.5; -A since OpenBSD 5.9; -C since OpenBSD 2.9; -D since OpenBSD 5.8; -P since OpenBSD 5.9; -e since OpenBSD 3.5; -s since OpenBSD 3.4; -t since OpenBSD 5.9; -w since OpenBSD 3.5.

--debug-syms until OpenBSD 3.4; --demangle until OpenBSD 3.4; --dynamic until OpenBSD 3.4; --extern-only until OpenBSD 3.4; --help until OpenBSD 3.4; --line-numbers until OpenBSD 3.4; --no-sort until OpenBSD 3.4; --numeric-sort until OpenBSD 3.4; --portability until OpenBSD 3.4; --print-armap until OpenBSD 3.4; --print-file-name until OpenBSD 3.4; --radix until OpenBSD 3.4; --reverse-sort until OpenBSD 3.4; --size-sort until OpenBSD 3.4; --target until OpenBSD 3.4; --undefined-only until OpenBSD 3.4; --version until OpenBSD 3.4; -B until OpenBSD 3.4; -V until OpenBSD 4.6; -f until OpenBSD 3.4; -l until OpenBSD 3.4; -v until OpenBSD 3.4.