CLI Reference > CLI Usage Overview > nm
  
nm
display symbol table of object, library, or executable file
Synopsis
nm [-AaefgnoPprsuvx] [-t format] file ...
Description
nm displays the symbol table associated with an object, archive library of objects, or executable file. nm recognizes several different file types that may contain symbol tables:
object files ending in .obj. These files may be Intel OMF (Object Module Format) files or COFF (Common Object File Format) files.
library files, which normally end in .lib and contain one or more OMF or COFF files.
Windows executable files, which normally end in .exe, that contain a symbol table compatible with those produced by PLINK86, the Microsoft Linker, the Watcom Linker, or the Borland Linker.
A symbol table may be created from a .map file (such as those produced by Microsoft link) by using unstrip to create a symbol table compatible with PLINK86.
Note that nm does not list entry points in a DLL, unless there is a symbol table associated with it.
By default, nm lists the symbols in file in alphabetical order by name and provides the following information on each:
File or object name (if you specified -A)
Symbol name
Symbol type:
* 
Not all of these symbol types are available on all systems. For instance, not all systems support the ability to determine different segment information.
A
absolute symbol, global
a
absolute symbol, local
B
uninitialized data (bss), global
b
uninitialized data (bss), local
D
initialized data, global
d
initialized data, local
F
file name
l
line number entry (see -a option)
N
no defined type, global; this is an unspecified type, compared to the undefined type U
n
no defined type, local; this is an unspecified type, compared to the undefined type U
S
section symbol, global
s
section symbol, local
T
text symbol, global
t
text symbol, local (static)
U
undefined symbol
?
unknown symbol
Symbol value
Symbol size, if applicable
Options
-A
prefixes each line with the file name or archive member name.
-a
displays all symbols, including line number entries on systems which support them.
-e
displays only global (external) and static symbols.
-f
displays full output. This is the default, since this implementation does not suppress any output.
-g
displays only global symbols.
-n
is equivalent to -v.
-o
displays output in octal (same as -t o).
-P
displays output in a portable POSIX-compliant format, with blanks separating the output fields. If you specified -A and file is not a library, the format is
file: name type value size
If you specified -A and file is a library, the format is
file[object_file]: name type value size
where object_file is the object file in the library which contains the symbol being described. If you did not specify -A, the format is
name type value size
If you did not also specify the -t option, nm displays value and size in hexadecimal.
If you did not specify -A and the command line contains more than one file, or file is a library, nm displays a line preceding the list of symbols for each specified file or each object file in a specified library. If file is a library, this line has the following format:
file[object_file]:
If file is not a library, the format is simply
file:
-p
does not sort output.
-r
reverses sort order.
-s
includes symbol size for each symbol.
-t format
defines the numeric value formatting base. The format shall be one of d, o, or x, for decimal, octal, or hexadecimal, respectively. If this option is not used, numbers are displayed in decimal.
-u
displays only undefined symbols.
-v
sorts output by value.
-x
displays information in hexadecimal (same as -t x).
Diagnostics
Possible exit status values are:
0
Successful completion.
1
Failure due to any of the following:
— invalid command line option
— missing file name
— unknown symbol table type
— invalid library file
— end-of-file found in library
— bad record in the library
— out of memory
If a file does not contain a symbol table, nm displays a warning and goes to the next file, but this is not considered an error.
Portability
POSIX.2. x/OPEN Portability Guide 4.0. Supported UNIX systems. Supported Microsoft Windows versions.
For the most current product platform support information, see https://www.ptc.com/en/support/refdoc/Integrity_Lifecycle_Manager/12.0/Integrity_Lifecycle_Manager_12_Product_Platforms.
The -a, -e, -f, -n, -o, -p, -r, -s and -x options are not part of the POSIX standard.
The -a, -n, -p, -r, -s options and -t d are not part of the x/OPEN standard.
Note
On Windows systems, data (D, d) and uninitialized data (B, b) are not currently recognized in executable files, as this involves trying to guess segment types. All such symbols come out as text (T, t) symbols.
Availability
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
Windchill RV&S
See Also
Commands: ar, size, strip