nm(1) General Commands Manual nm(1)
NAME
nm - print name list of common object file
SYNOPSIS
format] file ...
DESCRIPTION
The command displays the symbol table of each object file, file.
There are three general output formats: the default (neither nor specified), specified, and specified. The output formats are described
after the "Options" subsection.
By default, 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 its column, forcing every column after the name to be
misaligned.
Options
recognizes the following options:
Prefix each output line with the name of the object file or archive,
file. Equivalent to
Demangle C++ names before printing them (ELF only).
Display the value and size of a symbol in decimal. This is the default for the default format or the format. Equivalent to
Display only
and symbols. This option is ignored (see
Display full output.
This option is in force by default.
Display only
(global) symbol information.
Do not display the output header data.
Distinguish between weak and global symbols by appending * to the key
letter of weak symbols. Only takes effect with and/or
Sort symbols by
name, in ascending collation order, before they are printed. This is the default. See in below.
Display symbols in the order in which they appear in the symbol table.
Display the value and size of a symbol in octal. Equivalent to
Display information in a blank-separated output format.
Each symbol name is preceded by its value (blanks if undefined) and a letter to indicate type. A lowercase letter indi-
cates a local (nonexternal) symbol.
(absolute)
(bss symbol)
(common symbol)
(data symbol)
(milli symbol) ELF only
(notype) ELF only
(section region)
(tstorage symbol) SOM only
(text symbol)
(undefined)
If the symbol is a secondary definition, the type letter is followed by the letter
Note that is not compatible with
Display information in a portable output format, as specified below,
to standard output. Note that is not compatible with
Prefix each output line with the name of the object file or archive,
file. Equivalent to
(SOM only) Silence some warning messages.
Print the section index instead of the section name (ELF only).
Display each numeric value in the specified format.
format can be one of:
Display the
value and size of a symbol in decimal. This is the default for the default format or the format. Equivalent to
Display the
value and size of a symbol in octal. Equivalent to
Display the
value and size of a symbol in hexadecimal. This is the default for the format. Equivalent to
(SOM only) Truncate every name that would otherwise overflow its column
and place an asterisk as the last character in the displayed name to mark it as truncated. If or is also specified, the
file prefix is truncated first.
Display undefined symbols only.
Print the usage menu.
Sort symbols by
value before they are printed.
Display the executing version of the
command on standard error.
Display the value and size of a symbol in hexadecimal. This is the default for the format. Equivalent to
Operands
recognizes the following operand:
file A relocatable object file or an executable object file, or an archive of relocatable or executable object files.
Default Output Format - SOM
If the default (neither the nor the option) output format is specified, each symbol has the following columns, separated by vertical bars
The default for numbers is decimal or
If decimal:
If octal:
If hexadecimal:
Default Output Format - ELF
If the default (neither the nor the option) output format is specified, each symbol has the following columns, separated by vertical bars
The default for numbers is decimal or
If decimal:
If octal:
If hexadecimal:
The descriptions are explained below:
name The name of the symbol.
value Its value expressed as an offset or an address depending on its storage class.
scope The scope of the symbol or The scope indicates an external symbol that is flagged as a secondary definition.
type The type of the symbol
subspace The subspace to which the symbol belongs.
bind Specifies the symbol binding type (local, weak, global).
O This field is used for files that have large section tables (>65K sections). For smaller files, the value of this field
is 0.
Shndx Identifies the index of the section that the symbol belongs to.
Identifies the index of the symbol in the symbol table.
Output Format for -p
If the option is specified, information is displayed using the following portable C-language formats. The default for numbers is decimal
or
If decimal:
If octal:
If hexadecimal:
If or the line is preceded by:
Output Format for -P
If the option is specified, information is displayed using the following portable C-language formats. The default for numbers is hexadeci-
mal or In the format string, represents string output; represents decimal output; represents octal output; represents hexadecimal output;
represents newline; all other characters represent themselves.
o If decimal is specified:
o If octal is specified:
o If hexadecimal is specified, or by default:
where library-object is a string preformatted as follows:
o If and are not specified, library-object is an empty string.
o If or is specified, and the corresponding file operand does not name a library:
o If or is specified and the corresponding file operand names a library, object-file names the object file in the library containing the
symbol being described:
If and are not specified, and if more than one file operand is specified, or if a single file operand that names a library is specified,
then prints a line identifying the object containing the symbols before the lines containing those symbols, in one of the following forms:
o If the corresponding file operand does not name a library:
o If the corresponding file operand names a library, object-file names the object file in the library containing the symbol being
described:
EXTERNAL INFLUENCES
Environment Variables
The following internationalization variables affect the execution of
determines the locale category for native language, local customs and coded character set in the absence of or other environment variables.
If is not specified or is null, it defaults to (see lang(5)).
if set to a nonempty string value, determines the values for all locale categories and has precedence over and other environment variables.
determines the locale category for character collation.
determines the locale category for character handling functions.
determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
determines the locale category for numeric formatting.
and determine the location of message catalogues for processing
If an internationalization variable is not specified or is null, it defaults to the value of
If is not specified or is null, it defaults to (see lang(5)).
If any internationalization variable contains an invalid setting, then all internationalization variables default to (see environ(5)).
International Code Set Support
Single-byte character code sets are supported.
EXAMPLES
Display which object files have undefined references for the symbol
Display which object files have a definition for the text symbol leap:
WARNINGS
By default, now sorts symbols by name (the option). To turn off sorting, use the option.
Some options added for standards conformance duplicate the functionality of options that previously existed. This duplication has been
retained for backward compatibility.
SEE ALSO
System Tools
cc_bundled(1) HP-UX C compiler
ld(1) Link editor
Miscellaneous
crt0(3) Execution startup routine
end(3C) Symbol of the last locations in program
STANDARDS CONFORMANCE
nm(1)