nm(1) (Software Generation System Utilities) nm(1)
NAME
nm - print name list of an object file
SYNOPSIS
nm [ -oxhvnefurplVT ] files
DESCRIPTION
The nm command displays the symbol table of each ELF or COFF object
file, specified by file(s). The file may be a relocatable or
absolute ELF or COFF object file; or it may be an archive of
relocatable or absolute ELF or COFF object files. For each symbol,
the following information will be printed:
Index The index of the symbol. (The index appears in brackets.)
Value The value of the symbol is one of the following: a section
offset for defined symbols in a relocatable file; alignment
constraints for symbols whose section index is SHN_COMMON; a
virtual address in executable and dynamic library files.
Size The size in bytes of the associated object.
Type A symbol is of one of the following types: NOTYPE (no type
was specified), OBJECT (a data object such as an array or
variable), FUNC (a function or other executable code),
SECTION (a section symbol), or FILE (name of the source
file).
Bind The symbol's binding attributes. LOCAL symbols have a scope
limited to the object file containing their definition;
GLOBAL symbols are visible to all object files being
combined; and WEAK symbols are essentially global symbols
with a lower precedence than GLOBAL.
Other A field reserved for future use, currently containing 0.
Shndx Except for three special values, this is the section header
table index in relation to which the symbol is defined. The
following special values exist: ABS indicates the symbol's
value will not change through relocation; COMMON indicates
an unallocated block and the value provides alignment
constraints; and UNDEF indicates an undefined symbol.
Name The name of the symbol.
The output of nm may be controlled using the following options:
-o Print the value and size of a symbol in octal instead of
decimal.
7/91 Page 1
nm(1) (Software Generation System Utilities) nm(1)
-x Print the value and size of a symbol in hexadecimal instead
of decimal.
-h Do not display the output heading data.
-v Sort external symbols by value before they are printed.
-n Sort external symbols by name before they are printed.
-e See NOTES below.
-f See NOTES below.
-u Print undefined symbols only.
-r Prepend the name of the object file or archive to each
output line.
-p Produce easily parsable, terse output. Each symbol name is
preceded by its value (blanks if undefined) and one of the
letters U (undefined), N (symbol has no type), D (data
object symbol), T (text symbol), S (section symbol), or F
(file symbol). If the symbol's binding attribute is LOCAL,
the key letter is lower case; if the symbol's binding
attribute is WEAK, the key letter is upper case; if the -l
modifier is specified, the upper case key letter is followed
by a *; if the symbol's binding attribute is GLOBAL, the key
letter is upper case.
-l Distinguish between WEAK and GLOBAL symbols by appending a *
to the key letter for WEAK symbols.
-V Print the version of the nm command executing on the
standard error output.
-T See NOTES below.
Options may be used in any order, either singly or in combination,
and may appear anywhere in the command line. When conflicting
options are specified (such as nm -v -n) the first is taken and the
second ignored with a warning message to the user.
SEE ALSO
as(1), cc(1), dump(1), ld(1), ar(4).
NOTES
The following options are obsolete because of changes to the object
file format and will be deleted in a future release.
Page 2 7/91
nm(1) (Software Generation System Utilities) nm(1)
-e Print only external and static symbols. The symbol table
now contains only static and external symbols. Automatic
symbols no longer appear in the symbol table. They do
appear in the debugging information produced by cc -g, which
may be examined using dump(1).
-f Produce full output. Redundant symbols (such as .text,
.data, etc). which existed previously do not exist and
producing full output will be identical to the default
output.
-T By default, nm prints the entire name of the symbols listed.
Since symbol names have been moved to the last column, the
problem of overflow is removed and it is no longer necessary
to truncate the symbol name.
7/91 Page 3