Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nm(1) — SunOS 4.0.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1V)

as(1)

cc(1V)

ld(1)

tmpnam(3S)

a.out(5)

ar(5)

coff(5)

NM(1)  —  USER COMMANDS

NAME

nm − print name list

SYNOPSIS

nm [ −gnoprsua ] [ [ filename ] ...

Sun386i SYNOPSIS

/usr/bin/nm [−oxhvnefurpVT] filename ...

DESCRIPTION

nm prints the name list (symbol table) of each object filename in the argument list.  If an argument is an archive, a listing for each object file in the archive will be produced.  If no filename is given, the symbols in a.out are listed. 

Output Format

Each symbol name is preceded by its value (blanks if undefined) and one of the letters:

A absolute

B bss segment symbol

C common symbol

D data segment symbol

f filename

t a static function symbol

T text segment symbol

U undefined

− debug, giving symbol table entries (see −a below)

The type letter is upper case if the symbol is external, and lower case if it is local.  The output is sorted alphabetically. 

Sun386i DESCRIPTION

The Sun386i version of the System V compatibility package includes /usr/bin/nm, which allows the System V options to be used and creates the same output as the System V nm(1) command. 

The System V nm command displays the symbol table of COFF files.  filename may be a relocatable or absolute common object file; or it may be an archive of relocatable or absolute common object files.  For each symbol, the following information will be printed:

name The name of the symbol. 

value Its value expressed as an offset or an address depending on its storage class. 

class Its storage class. 

type Its type and derived type.  If the symbol is an instance of a structure or of a union then the structure or union tag will be given following the type (e.g., struct-tag).  If the symbol is an array, then the array dimensions will be given following the type (e.g., char[ n ][ m ]).  Note that the object file must have been compiled with the −g option of the cc(1V) command for this information to appear. 

size Its size in bytes, if available.  (must be compiled with cc−g). 

line The source line number at which it is defined, if available.  (must be compiled with cc−g). 

section For storage classes static and external, the object file section containing the symbol (e.g., text, data or bss). 

OPTIONS

−a Print all symbols. 

−g Print only global (external) symbols. 

−n Sort numerically rather than alphabetically. 

−o Prepend file or archive element name to each output line rather than only once. 

−p Do not sort; print in symbol-table order. 

−r Sort in reverse order. 

−s Sort according to the size of the external symbol (computed from the difference between the value of the symbol and the value of the symbol with the next higher value).  This difference is the value printed. 

−u Print only undefined symbols. 

Sun386i OPTIONS

−o Print the value and size of a symbol in octal instead of decimal. 

−x Print the value and size of a symbol in hexadecimal instead of decimal. 

−h Do not display the output header data. 

−v Sort external symbols by value before they are printed. 

−n Sort external symbols by name before they are printed. 

−e Print only external and static symbols. 

−f Produce full output.  Print redundant symbols (.text, .data, .lib,  and .bss), normally suppressed. 

−u Print undefined symbols only. 

−r Prepend the name of the object file or archive to each output line. 

−p Produce easily parsable, terse output.  Each symbol name is preceded by its value (blanks if undefined) and one of the letters U (undefined), A (absolute), T (text segment symbol), D (data segment symbol), S (user defined segment symbol), R (register symbol), F (file symbol), or C (common symbol).  If the symbol is local (non-external), the type letter is in lower case. 

−V Print the version of the System V nm command executing on the standard error output. 

−T By default, System V nm prints the entire name of the symbols listed.  Since object files can have symbols 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.  The −T option causes System V nm to truncate every name which would otherwise overflow its column and place an asterisk as the last character in the displayed name to mark it as truncated. 

Options may be used in any order, either singly or in combination, and may appear anywhere in the command line.  Therefore, both /usr/bin/nm name −e −v and /usr/bin/nm −ve name print the static and external symbols in name, with external symbols sorted by value.

EXAMPLE

example% nm

prints the symbol list of the file named a.out, the default output file for the C, compiler. 

SEE ALSO

ar(1V), as(1), cc(1V), ld(1), tmpnam(3S), a.out(5), ar(5), coff(5)

BUGS

To see what is in a shared library, run nm on the static (.a) version. 

Sun386i BUGS

When all the symbols are printed, they must be printed in the order they appear in the symbol table in order to preserve scoping information.  Therefore, the −v and −n options should be used only in conjunction with the −e option. 

Sun386i DIAGNOSTICS

nm: name: cannot open
if name cannot be read. 

nm: name: bad magic
if name is not a common object file. 

nm: name: no symbols
if the symbols have been stripped from name.

Sun Release 4.0  —  Last change: 22 March 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026