NAME

SYNOPSIS

DESCRIPTION

The nm utility displays the symbol table of each ELF object file that is specified by file.

If no symbolic information is available for a valid input file, the nm utility will report that fact, but not consider it an error condition.

OPTIONS

The output of nm may be controlled using the following options:

-A
Writes the full path name or library name of an object on each line.

-C
Demangles C++ symbol names before printing them out.

-D
Displays the SHT_DYNSYM symbol information. This is the symbol table used by ld.so.1 and is present even in stripped dynamic executables. By default, the SHT_SYMTAB symbol table is displayed.

-e
See NOTES below.

-f
See NOTES below.

-g
Writes only external (global) symbol information.

-h
Does not display the output heading data.

-l
Distinguishes between WEAK and GLOBAL symbols by appending a * to the key letter for WEAK symbols.

-n
Sorts external symbols by name before they are printed.

-o
Prints the value and size of a symbol in octal instead of decimal (equivalent to -to).

-p
Produces easy to parse, terse output. Each symbol name is preceded by its value (blanks if undefined) and one of the letters:

A
Absolute symbol.

B
bss (uninitialized data space) symbol.

C
COMMON symbol.

D
Data object symbol.

F
File symbol.

N
Symbol has no type.

L
Thread-Local storage symbol.

S
Section symbol.

T
Text symbol.

U
Undefined.

If the symbol's binding attribute is:

LOCAL
The key letter is lower case.

WEAK
The key letter is upper case. If the -l modifier is specified, the upper case key letter is followed by a *

GLOBAL
The key letter is upper case.

-P
Writes information in a portable output format, as specified in Standard Output.

-r
Prepends the name of the object file or archive to each output line.

-R
Prints the archive name (if present), followed by the object file and symbol name. If the -r option is also specified, this option is ignored.

-s
Prints section name instead of section index.

-tformat
Writes each numeric value in the specified format. The format is dependent on the single character used as the format option-argument:

d
The offset is written in decimal (default).

o
The offset is written in octal.

x
The offset is written in hexadecimal.

-T
See NOTES below.

/usr/ccs/bin/nm

-u
Prints undefined symbols only.

/usr/xpg4/bin/nm

-u
Prints long listing for each undefined symbol. See OUTPUT below.

-v
Sorts external symbols by value before they are printed.

-V
Prints the version of the nm command executing on the standard error output.

-x
Prints the value and size of a symbol in hexadecimal instead of decimal (equivalent to -tx).

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 -v and -n, or -o and -x) the first is taken and the second ignored with a warning message to the user. (See -R for exception.)

OPERANDS

The following operand is supported:

file
A path name of an object file, executable file or object-file library.

•
If -A is specified and the corresponding file operand does not name a library:

"%s: ", file

•
If -A is specified and the corresponding file operand names a library. In this case, object file names the object file in the library containing the symbol being described:

"%s[%s]: ", file, object file

If -A is not specified, then if more than one file operand is specified or if only one file operand is specified and it names a library, nm will write a line identifying the object containing the following symbols before the lines containing those symbols, in the form:

•
If the corresponding file operand does not name a library:

"%s:\n", file

•
If the corresponding file operand names a library; in this case, object file is the name of the file in the library containing the following symbols:

"%s[%s]:\n", file, object file

If -P is specified, but -t is not, the format is as if -tx had been specified.

ENVIRONMENT VARIABLES

See environ(5) for descriptions of the following environment variables that affect the execution of nm: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH.

/usr/xpg4/bin/nm

SEE ALSO

NOTES

The following options are obsolete because of changes to the object file format and will be deleted in a future release.

-e
Prints 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
Produces full output. Redundant symbols (such as .text, .data, and so forth), 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.