The nm(1) utility displays symbolic information stored in
the object file, executable file, or an object-file library
specified by file. A file cannot have any symbol information
stored in it. A file must be created with symbolic information.
(For example, the -g option to c89(1), cc(1),
and gcc(1) stores symbolic information in created object
files.)
The nm(1) utility takes the following options:
-A
Display the full path name or library name of the object on
each line.
-e
Display only external and static symbols.
-f
Use the full output format, including symbols normally
suppressed, such as .text.
-g
Display only the external (global) symbols.
-l
Display the source file and line number of each symbol.
-o
Display numeric values in octal (this is equivalent to -t
o).
-P
Use the portable format; see the description for more
details.
-tformat
Use the specified format for numeric values. The
format is d (decimal; the default), o (octal),
or x (hexadecimal).
-u
Display only those symbols that are undefined.
-v
Display the output sorted by value rather than
alphabetically.
-x
Display numeric values in hexadecimal (this is equivalent to
-t x).
The output is sorted alphabetically by symbol name. For each
symbol, nm(1) writes:
name value type symbol_name
name
The name of the file; displayed only only if the -A
option is given.
value
Offset in the file; the default format is decimal, though this
can be changed by the -o, -t, or -x
options.
type
The symbol's type, which is one of the following:
A
Absolute symbol, global.
a
Absolute symbol, local.
B
BSS (uninitialized data space) symbol, global.
b
BSS (uninitialized data space) symbol, local.
C
Common. These symbols are uninitialized data. When linking, the
same name might appear on more than one common symbol. These
symbols are treated as undefined references if the symbol is
defined anywhere. The --warn-common option to the linker
will warn about the combining of common symbols.
D
Data symbol, global.
d
Data symbol, local.
e
The .edata sections.
G
Initialized data symbol for small objects. This is used by some
object file formats to permit more efficient access to small data
objects.
I
Indirect reference to another symbol. This is a GNU extension
in the a.out format and is rarely used.
i
Initialized data, such as .idata or .drectve
sections.
N
Debugging symbol.
p
The .pdata sections.
R
Symbol is in a read-only data section.
S
Uninitialized data symbol for small objects. See G.
T
Text symbol, global.
t
Text symbol, local.
U
Undefined symbol.
W
Weak symbol. A weak symbol is like a global symbol but it has a
lower precedence. When a weak defined symbol is linked with a
normal defined symbol, the normal defined symbol is used and no
error is reported. When a weak undefined symbol is linked, and the
symbol is not defined, the value of the weak symbol becomes zero
and no error is reported.
-
The symbol is a stabs symbol in an a.out object file.
The next values printed are the stabs other field, the stabs desc
field, and the stab type. Stabs symbols are used to hold debugging
information; see GNU documentation on the stabs debug format for
more information.
?
Unknown symbol type, or a type specific to the object file
format.
symbol_name
The symbol name.
If you specify more than one file, or if file is a
library, nm(1) displays the file name or the library and
module name before the list of symbols for that file or module.
If you specify the -A option, nm(1) writes the
file name before each line of output.
The -P option changes the output format to:
name type value
The default format for value is hexadecimal when you
specify -P. Multiple occurrences of file and the
-A flag are handled in the same as normal output.