Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ar(1V)

as(1)

nm(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

$CCROOTDIR/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. 

If the symbol is a C++ mangled symbol, nm++ will print out its demangled format.  All mangled C++ symbols are bracketed by [ ] following the demangled symbol.  For regular mangled C++ function names (including member and non-member functions), function prototype is used as its demangled format.  For example, ___ct__13Iostream_initFv is printed as:

Iostream_init::Iostream_init(). 

C++ static constructors and destructors are demangled and printed in the following format:

static constructor function for <file_name>

or

static destructor function for <file_name>. 

For example, ___std_____stream_in_c___Fv is demangled as static destructor function for ___stream_in_c. 

For C++ virtual table symbols, its mangled name takes the following format:

___vtbl__<class>
___vtbl__<root_class>__<derived_class>

In the nm++ output, the demangled names for the virtual table symbols are printed as

virtual table for <class>

 virtual table for class <derived_class> derived from <root_class>

For example, the demangled format of

___vtbl__7fstream

is

virtual table for fstream

and the demangled format of

___vtbl__3ios__18ostream_withassign

is

virtual table for class ostream_withassign derived from ios. 

Some C++ symbols are pointers to the virtual tables, their mangled names take the following format:

___ptbl__<class>___<Filename>
___ptbl__<root_class>__<derived_class>___<Filename>

In the nm++ output, the demangled names for these symbols are printed as:

pointer to virtual table for <class> in <Filename>
pointer to virtual table for class <derived class> derived from <root_class> in <Filename>

For example, the demangled format of

___ptbl__3ios_____stream_fstream_c

is

pointer to the virtual table for ios in __stream_fstream_c

and the demangled format of

___ptbl__3ios__11fstreambase_____stream_fstream_c

is

pointer to the virtual table for class fstreambase derived from ios in ___stream_fstream_c

Sun386i DESCRIPTION

The Sun386i version of the System V compatibility package includes $CCROOTDIR/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 $CCROOTDIR/nm++ name −e −v and $CCROOTDIR/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/C++ compiler(s). 

NOTE

Some C++ symbols contain file name information.  A SunOS file name path can contain characters (such as ‘.’ and ‘/’) that cannot be used to encode assembler symbols.  Those characters are transformed into ‘_’.  For example, ../stream_io.c is represented as ___stream_io_c in C++ mangled symbol.  nm++ does not second-guess or demangle ‘_’ in the file name path string. 

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. 

LIMITATIONS

The demangling scheme will not handle the functions that take more than 35 arguments. 

SEE ALSO

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

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: 20 July 1989

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