NM(1) SysV NM(1)
NAME
nm - print name list of common object file
SYNOPSIS
nm [ options ] filename . . .
DESCRIPTION
nm displays the symbol table of each common object file listed on the
command line. The filename argument may refer to a relocatable or
absolute common object file; or it may be an archive of relocatable or
absolute common object files. For each symbol, the following information
is printed:
Name The name of the symbol.
Value Its value expressed as an offset or an address depending on its
storage class.
Class Its storage class.
Type Its type and derived type. If the symbol is an instance of a
structure or of a union then the structure or union tag will be
given following the type (e.g., struct-tag). If the symbol is
an array, then the array dimensions will be given following the
type (e.g., char[ n ][ m ] ). Note that the object file must
have been compiled with the -g option of the cc(1) command for
this information to appear.
Size Its size in bytes, if available. Note that the object file must
have been compiled with the -g option of the cc(1) command for
this information to appear.
Line The source line number at which it is defined, if available.
Note that the object file must have been compiled with the -g
option of the cc(1) command for this information to appear.
Section For storage classes static and external, the object file section
containing the symbol (e.g., text, data or bss).
The options listed below may be used in any order, either singly or in
combination, and they may appear anywhere in the command line.
Therefore, both nm name -e -v and nm -ve name print the static and
external symbols in name, with external symbols sorted by value.
OPTIONS
-o Prints the value and size of a symbol in octal instead of
decimal.
-x Prints the value and size of a symbol in hexadecimal instead of
decimal.
-h Does not display the output header data.
-v Sorts external symbols by value before they are printed.
-n Sorts external symbols by name before they are printed.
-e Prints only external and static symbols.
-f Produces full output. Prints redundant symbols (.text, .data,
.lib, and .bss), normally suppressed.
-u Prints undefined symbols only.
-r Prepends the name of the object file or archive to each output
line.
-p Produces easily parsable, terse output. Each symbol name is
preceded by its value (blanks if undefined) and one of the
letters U (undefined), A (absolute), T (text segment symbol), D
(data segment symbol), S (user defined segment symbol), R
(register symbol), F (file symbol), C (common symbol), or G
(global symbol) if -Ag is also specified. If the symbol is
local (non-external), the type letter is in lowercase.
-V Prints the version of the nm command executing on the standard
error output.
-T By default, nm prints the entire name of the symbols listed.
Since object files can have symbols names with an arbitrary
number of characters, a name that is longer than the width of
the column set aside for names will overflow its column,
forcing every column after the name to be misaligned. The -T
option causes nm to truncate every name which would otherwise
overflow its column and place an asterisk as the last character
in the displayed name to mark it as truncated.
-Ag Checks in KGT (Known Global Table) to see if undefined globals
are defined in global libraries. This affect the -p and -u
options.
BUGS
When all the symbols are printed, they must be printed in the order they
appear in the symbol table in order to preserve scoping information.
Therefore, the -v and -n options should be used only in conjunction with
the -e option.
FILES
TMPDIR/* temporary files
TMPDIR is usually /usr/tmp but can be redefined by setting the
environment variable TMPDIR [see tempnam() in tmpnam(3S)].
DIAGNOSTICS
"nm: name: cannot open"
if name cannot be read.
"nm: name: bad magic"
if name is not a common object file.
"nm: name: no symbols"
if the symbols have been stripped from name.
SEE ALSO
cc(1), ld(1), tmpnam(3S), a.out(4), ar(4).