nm Command Purpose Displays the symbol table of an object file. Syntax nm [ -C ] [ -f ] [ -h ] [ -O ] [ -r ] [ -T ] [ -u ] [ [ -e ] [ -n | -v ] ] [ -o | -x | -d ] [ File ... ] Description The nm command writes the symbol table of each specified object File to standard output. File can be a single relocatable or ab- solute common object file or an archive library of relocatable or absolute common object files. nm displays the following for each symbol: Name The name of the symbol. Value The value of the symbol expressed as an offset or an ad- dress depending on its storage class. Class The storage class of the symbol. Type The type and derived type of the symbol. If the symbol refers to a structure or a union, the structure or union tag fol- lows the type declaration. If the symbol is an array, the array dimensions follow the type. Note that you must have compiled the object file with cc -g for this information to appear. Size The size of the symbol, in bytes if available. Note that you must have compiled the object file with cc -g for this infor- mation to appear. Line The source line number at which it is defined, if available. Note that you must have compiled the object file with cc -g for this information to appear. Section For static and external storage classes, the object file section containing the symbol. Flags -C Suppresses the demangling of C++ names. The default is to de- mangle 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 symbols. -f Displays full output. Provides information on .text, .data, and .bss symbols. -h Does not display output header data. -n Sorts external symbols by name before displaying them. Use this flag only in conjunction with the -e flag. -o Displays a symbol's value and size as an octal rather than a decimal number. -O Prepends file or archive element name to each output line rather than only once. -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. -u Displays only undefined symbols. -v Sorts external symbols by value before displaying them. Use this flag only in conjunction with the -e flag. -x Displays a symbol's value and size as a hexadecimal rather than a decimal number. Exit Status This command returns the following exit values: 0 Successful completion. >0 An error occurred. Examples 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 -exv a.out Implementation Specifics This command is part of Base Application Development Toolkit. There are two versions of the nm command. /usr/ucb/nm contains the BSD version. /usr/ccs/bin/nm contains the AT&T version. The file /usr/ccs/bin/nm is linked to the appropriate version. Files /usr/ucb/nm Contains the BSD version of the nm command. /usr/ccs/bin/nm Contains the AT&T version of the nm command. Related Information Commands Overview in AIX Version 3.2 System User's Guide: Base and Devices. The ar command, as command, ld command, nm command (BSD), size command, strip command. The a.out file, ar file. nm Command (BSD) Purpose Displays the symbol table of an object file. Syntax /usr/ucb/nm [ -a ] [ -g ] [ -n ] [ -o ] [ -p ] [ -r ] [ -u ] [ File ... ] Description The nm command prints the symbol table of each specified object File to standard output. File can be a single relocatable or ab- solute common object file or an archive library of relocatable or absolute common object files. If File is an archive, a listing for each object file in the archive is produced. If no File is given, the symbols in the a.out file are listed. Each symbol name is preceded by its value (blanks if undefined) and one of the letters U (undefined), A (absolute), T (text seg- ment symbol), D (data segment symbol), B (BSS segment symbol), f (file name), or - (minus sign) for debugger symbol table entries (see -a below). If the symbol is local (non-external) the type letter is in lower case. The output is sorted alphabetically. Flags -a Prints symbol table entries inserted for use by debuggers. -g Prints only global (external) symbols. -n Sorts numerically rather than alphabetically. -o Prepends file or archive element name to each output line rather than only once. -p Doesn't sort; prints in symbol-table order. -r Sorts in reverse order. -u Prints only undefined symbols. Examples 1. To list the external symbols of the object file a.out, enter: nm -g a.out 2. To list the external symbols and sort them in numeric order, enter: nm -ng a.out Implementation Specifics This command is part of Base Application Development Toolkit. Related Information Subroutines Overview in AIX Version 3.2 General Programming Con- cepts. The ar command, nm command. The a.out file.