NM ( 1 ) USER COMMANDSNM ( 1 )


NAME

nm - print a list of symbols from object files

SYNOPSIS

nm [ options ] [file ...]

DESCRIPTION

The nm command prints formatted listings of the symbol tables for each file specified. A file can be a relocatable object file, or it can be an archive.

nm produces different output formats depending on options.

When Using AT&T System V Release 4 format, the following information will be printed for each symbol (an alternative, Berkeley (4.3BSD) format, is described later in this man page):
Index
The index of the symbol. (The index appears in brackets.)
Value
The value of the symbol.
Size
The size in bytes of the associated object.
Type
A symbol is 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.
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.
Other
Currently DEFAULT.
Shndx
This is the section header table index in relation to which the symbol is defined or is UNDEF for a symbol that is not defined.
Name
The name of the symbol.

nm -B produces Berkeley output format with address or value field followed by a letter showing what section the symbol is in and the name of the symbol. The following section letters describe the information that nm generates:
T
External text.
t
Local text.
D
External initialized data.
d
Local initialized data.
B
External zeroed data.
b
Local zeroed data.
A
External absolute.
a
Local absolute.
U
External undefined.
G
External small initialized data.
g
Local small initialized data.
S
External small zeroed data.
s
Local small zeroed data.
R
External read only.
r
Local read only.

In XPG4 mode the format is specified by the XPG4 standard. The output is sorted alphabetically by symbol name. The following information is output:
File
Object or library name, if -A is specified
Name
Symbol name
Type
Symbol type, which will be one of the following singlecharacters (or one of the Berkeley format letters where non-conflicting with the following list)
A
Global absolute symbol
a
Local absolute symbol
B
External zeroed data
b
Local zeroed data
D
Global data symbol
d
Local data symbol
T
Global text symbol
t
Local text symbol
U
Undefined symbol
Value
he value of the symbol.
Size
The size of the symbol (0 if size not available).

If no file is given, or if the file is -, nm prints the symbol information from standard input.

The nm command supports the options listed below. NOTE: The meaning of -o depends on whether -A(AT&T) or -B is in effect when -o is encountered (the meaning depends on the relative ordering of the options).

OPTIONS

-A
Use AT&T System V Release 4 format output.
-B
Use Berkeley (4.3BSD) format output. Overrides XPG4 mode.
-N
Produces only names of global text and data symbols with no headings.
-P, --portability
In XPG4 mode, write information in a portable output format according to the XPG standard.
-b
Print the value field in octal.
-d
Print the value field in decimal. This is the default value field radix for -A.
-e
Print externals and statics only.
-g
Print only globally-visible names.
-h
Do not print headers.
-n
When used alone or with -A, sort symbols by name. By name isthe default sort order for -B. When used with -B, sort all symbols by value.
-o
When used alone or with -A, print the value field in octal. When used with -B, prepend the filename to output line. This is useful for using grep to search through nm libraries.
-p
Produce easily parsable, terse output.
-r, --print-file
Prepend the name of the object file or archive to each output line (Berkeley or XPG style) or name (ATT or default style).
-t, --radix=radix
In XPG4 mode, write each numeric value in the specifiedradix. The radix should be one of the following:
d
The offset will be written in decimal.
o
The offset will be written in octal.
x
The offset will be written in hexadecimal.
-u, --undefined_only
Print only undefined symbols.
-v
Sort symbols by value.
-x
Print value field in hexadecimal. This is the default value field radix for -B.

EXIT STATUS

0
Symbols from all files printed successfully.
>0
An error occurred.

SEE ALSO

ar(1),cc(1)

IMPLEMENTATION

version
nm (AT&T Labs Research) 2002-09-06
author
Glenn Fowler <glenn.s.fowler@gmail.com >
author
David Korn <dgkorn@gmail.com>
author
Phong Vo <kpv@research.att.com>
copyright
Copyright © 1986-2010 AT&T Intellectual Property
license
http://www.opensource.org/licenses/cpl1.0.txt