[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 4

nm Command


Displays information about symbols in object files, executable files, and object-file libraries.


nm-A ] [ -C ] [ -X  {32|64|32_64}]-f ] [ -h ] [ -p ] [ -r ] [ -T ] [ -v ] [ -B -P ] [ -e | -g-u ] [ -d -o -x -t Format ] File ...


The nm command displays information about symbols in the specified File, which can be an object file, an executable file, or an object-file library. If the file contains no symbol information, the nm command reports the fact, but does not interpret it as an error condition. The nm command reports numerical values in decimal notation by default.

The nm command writes the following symbol information to standard output:


-A Displays either the full path name or library name of an object on each line.
-B Displays output in the Berkeley Software Distribution (BSD) format:
value   type   name
-C Suppresses the demangling of C++ names. The default is to demangle all C++ symbol names.
Note: Symbols from C++ object files have their names demangled before they are used.
-d Displays a symbol's value and size as a decimal. This is the default.
-e Displays only static and external (global) symbols.
-f Displays full output, including redundant .text, .data, and .bss symbols, which are normally suppressed.
-g Displays only external (global) symbols.
-h Suppresses the display of output header data.
-o Displays a symbol's value and size as an octal rather than a decimal number.
-P Displays information in a standard portable output format:
library/object name   name   type   value   size

This format displays numerical values in hexadecimal notation, unless you specify a different format with the -t, -d, or -o flags.

The -P flag displays the library/object name field only if you specify the -A flag. Also, the -P flag displays the size field only for symbols for which size is applicable.

-p Does not sort. The Ouput is printed in symbol-table order.
-r Sorts in reverse order.
-T Truncates every name that would otherwise overflow its column, making the last character displayed in the name an asterisk. By default, nm displays the entire name of the symbols listed, and a name that is longer than the width of the column set aside for it causes every column after the name to be misaligned.
-t Format Displays numerical values in the specified format, where the Format parameter is one of the following notations:
Decimal notation. This is the default format for the nm command.
Octal notation.
Hexadecimal notation.
-u Displays only undefined symbols.
-v Sorts output by value instead of alphabetically.
-x Displays a symbol's value and size as a hexadecimal rather than a decimal number.
-Xmode Specifies the type of object file nm should examine. The mode must be one of the following:
Processes only 32-bit object files
Processes only 64-bit object files
Processes both 32-bit and 64-bit object files

The default is to process 32-bit object files (ignore 64-bit objects). The mode can also be set withe the OBJECT_MODE environment variable. For example, OBJECT_MODE=64 causes nm to process any 64-bit objects and ignore 32-bit objects. The -X flag overrides the OBJECT_MODE variable.

Note: The nm command supports the -- (double hyphen) flag. This flag distinguishes a File operand if the file name can be misinterpreted as an option. For example, to specify a file name that begins with a hyphen, use the -- flag:

Exit Status

This command returns the following exit values:

0 Successful completion.
>0 An error occurred.


  1. To list the static and external symbols of the object file a.out , enter:
    nm -e a.out
  2. To display symbol sizes and values as hexadecimal and sort the symbols by value, enter:
    nm -xv a.out
  3. To display symbol of all 64-bit objects in libc.a, ignoring all 32-bit objects:
    nm -X64 /usr/lib/libc.a


/usr/ccs/bin/nm Contains the nm command.

Related Information

The ar command, as command, ld command, size command, strip command.

The a.out file, ar file.

Commands Overview in AIX Version 4.3 System User's Guide: Operating System and Devices.

[ Previous | Next | Contents | Glossary | Home | Search ]