Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nm(1) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

nm(1)  —  Commands

NAME

nm − name list dump of object files

SYNOPSIS

nm  [−B|-P|-S] [-abdfhnoprvwxATV] [−e|-g|-u] [−t format] [−demangled_name_info] [−mangled_name_only] [−mangled_name_also] [ file... ]

DESCRIPTION

The nm command prints formatted listings of the symbol and external sections of an object file symbol table.  A file can be an object file, an archive library, or a shared library.  If you do not specify a file, this command assumes a.out. 

The following list of section letters describe the information that nm generates in the default, portable (−P), and Berkeley (−B) formats.  If a symbol is external, the type letter is uppercase.  If a symbol is local (non-external), the type letter is lowercase. 

A external absolute

a local absolute

B external zeroed data

b local zeroed data

C common

D external initialized data

d local initialized data

E small common

G external small initialized data

g local small initialized data

N nil storage class, compiler internal usage

Q read only constants

q local read only constants

R external read only

r local read only

S external small zeroed data

s local small zeroed data

T external text

t local text

U external undefined

V external small undefined

Z no storage allocated

The System V format (−S) and the −a specified debug format provide an expanded listing with these columns:

Name The symbol or external name

Value Value field for the symbol or external, usually an address or interesting debugging information

Class The symbol type

Type The symbol’s language declaration

Size The symbol’s size (accurate only for objects compiled with debugging information preserved as in cc −g)

Index The symbol’s index field

Section
The symbol’s storage class

NOTE: In the System V (−S) format, every effort was made to map the field’s functionality into System V nomenclature. 

FLAGS

The nm command accepts these options:

−aPrints debugging information using System V format

−bFor Berkeley (−B) format only, prints the value field in octal.  Equivalent to −t o. 

−dPrints the value field in decimal (default for System V and default output formats). Equivalent to −t d. 

−ePrints external and statics only

−fProduces full output. (The nm command still accepts this old option, but ignores it.) 

−gPrints only global symbols

−hDoes not print headers

−nFor Berkeley (−B) format, sorts all symbols by value. For all other formats, sorts external symbols by name (default for Berkeley). 

−oPrints the value field in octal for all formats except Berkeley (−B). (Equivalent to −t o.)  For Berkeley format, prepends the filename to each symbol. (Equivalent to −A)

−pPrints symbols as they are found in the file (the System V default)

−rReverses the sense of a value or name sort

−t format
Write each numeric value in the specified format as follows:

dThe offset is written in decimal (default for System V and default output formats). Equivalent to −d. 

oThe offset is written in octal. Equivalent to −o. 

xThe offset is written in hexadecimal (default for Berkeley and portable formats). Equivalent to −x. 

−uPrints only undefined symbols

−vSorts external symbols by value

−wIdentifies weak symbols using an asterisk (∗). For the default, portable (−P), and Berkeley (−B) formats, the asterisk follows the symbol type letter. For System V (−S), an additional column is added to the end of each line containing an asterisk for weak symbols. 

−xPrints value field in hexadecimal (default for Berkeley and portable formats).  Equivalent to −t x. 

−APrepends the filename to each symbol. This is useful for using the grep command to check through nm listings of libraries. 

−BPrints Berkeley (4.3 BSD)-style output. This format produces an address or value field followed by a letter showing what section the symbol or external is located in. The third and final field is the name of the symbol or external. 

−PPrints output in a portable format. This format prints lines containing each symbol’s name, type (single letter), value, and size. 

−SPrints AT&T System V-style output. 

−TTruncates long names, inserting a ‘∗’ as the last printed character

−VPrints version information on stderr

The DEC C++ compiler encodes type information in function, template, variable, and virtual table names  to enable type-safe linkages.  This encoding is called "name mangling."  You can instruct the nm command to print either the original name (that is, the demangled name), the mangled name, or both, by specifying one of the following flags.  By default, nm shows the demangled names only. 

−demangled_name_info
For each mangled name of a class’s virtual function dispatch table (vtbl), prints a reminder to the user to define the first member function in the class, so that cxx will emit a definition of the vtbl.  An undefined vtbl symbol causes ld to issue an undefined symbol message. 

−mangled_name_only
Prints only the mangled name.

−mangled_name_also
Prints both the mangled and the demangled names.

RELATED INFORMATION

Programmer’s Guide
Assembly Language Programmer’s Guide

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