nm(1) nm(1)
NAME
nm - print name list of common object file
SYNOPSIS
nm [-d] [-e] [-f] [-h] [-n] [-o] [-T] [-u] [-v] [-V] [-x]
filename(s)
DESCRIPTION
The nm command displays the symbol table of each common
object file filename. filename may be a relocatable or
absolute common object file, or it may be an archive of
relocatable or absolute common object files. nm prints the
following information for each symbol. Note that the object
file must have been compiled with the -g flag option of the
cc(1) command for there to be type, size, or line
information.
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.
tv If the symbol is accessed through a transfer vector,
this field contains tv.
type Its type and derived type. If the symbol is an
instance of a structure or a union, the structure or
union tag is given following the type (e.g., struct-
tag). If the symbol is an array, the array dimensions
are given following the type (e.g., char[n] [m]).
size Its size in bytes, if available.
line The source line number at which it is defined, if
available.
section
For storage classes static and external, the object
file section containing the symbol (e.g., text, data,
or bss).
The output of nm may be controlled using the following flag
options:
-d Print the value and size of a symbol in decimal
instead of hexadecimal.
-o Print the value and size of a symbol in octal
Page 1 (last mod. 1/16/87)
nm(1) nm(1)
instead of hexadecimal.
-x Print the value and size of a symbol in hexadecimal
(the default).
-h Do not display the output header data.
-v Sort external symbols by value before they are
printed.
-n Sort external symbols by name before they are
printed.
-e Print only static and external symbols.
-f Produce full output. Redundant symbols (.test,
.data, .bss), normally suppressed, are printed.
-u Print undefined symbols only.
-V Print the version of the nm command executing on
the standard error output.
-T Truncate long names. By default, nm prints the
entire name of the symbols listed. Since object
files can have symbol names with an arbitrary
number of characters, a name that is longer than
the width of the column set aside for names will
overflow, forcing every column after the name to be
misaligned. The -T flag 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.
Flag options may be used in any order, either singly or in
combination, and 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.
FILES
/bin/nm
/usr/tmp/nm??????
WARNINGS
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 flag
options should be used only in conjunction with the -e flag
option.
Page 2 (last mod. 1/16/87)
nm(1) nm(1)
SEE ALSO
as(1), cc(1), ld(1), a.out(4), ar(4).
DIAGNOSTICS
nm: name: cannot open
name cannot be read.
nm: name: bad magic
name is not an appropriate common object file.
nm: name: no symbols
The symbols have been stripped from name.
Page 3 (last mod. 1/16/87)