The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

nm - write the name list of an object file (DEVELOPMENT)

 SYNOPSIS



nm [-APv][-efox][ -g| -u][-t format] file...

 DESCRIPTION

The nm utility displays symbolic information appearing in the object file, executable file or object-file library named by file. If no symbolic information is available for a valid input file, the nm utility will report that fact, but not consider it an error condition.

The default base used when numeric values are written is decimal.

 OPTIONS

The nm utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported:

-A
Write the full pathname or library name of an object on each line.
-e
Write only external (global) and static symbol information.
-f
Produce full output. Write redundant symbols (.text, .data and .bss), normally suppressed.
-g
Write only external (global) symbol information.
-o
Write numeric values in octal (equivalent to t-o).
-P
Write information in a portable output format, as specified in the STDOUT section.
-t format
Write each numeric value in the specified format. The format is dependent on the single character used as the format option-argument:
d
The offset is written in decimal (default).
o
The offset is written in octal.
x
The offset is written in hexadecimal.

-u
Write only undefined symbols.
-v
Sort output by value instead of alphabetically.
-x
Write numeric values in hexadecimal (equivalent to t-x).

 OPERANDS

The following operand is supported:
file
A pathname of an object file, executable file or object-file library.

 STDIN

See the INPUT FILES section.

 INPUT FILES

The input file must be an object file, an object-file library whose format is the same as those produced by the ar utility for link editing, or an executable file. The nm utility may accept additional implementation-dependent object library formats for the input file.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of nm:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_COLLATE
Determine the locale for character collation information for the symbol-name and symbol-value collation sequences.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

If symbolic information is present in the input files, then for each file or for each member of an archive, the nm utility will write the following information to standard output. By default, the format is unspecified, but the output is sorted alphabetically by symbol name.

This information may be supplemented by additional information specific to the implementation.

If the -P option is specified, the previous information is displayed using the following portable format. The three versions differ depending on whether -t d, -t o or -t x was specified, respectively:

"%s%s %s %d %d\n", <library/object name>,
<name>,
<type>,
<value>,
<size>

"%s%s %s %o %o\n", <library/object name>,
<name>,
<type>,
<value>,
<size>

"%s%s %s %x %x\n", <library/object name>,
<name>,
<type>,
<value>,
<size>


where <library/object name> is formatted as follows:

If -A is not specified, then if more than one file operand is specified or if only one file operand is specified and it names a library, nm will write a line identifying the object containing the following symbols before the lines containing those symbols, in the form:

If -P is specified, but -t is not, the format is as if -t x had been specified.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

Mechanisms for dynamic linking make this utility less meaningful when applied to an executable file because a dynamically linked executable may omit numerous library routines that would be found in a statically linked executable.

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

ar, c89.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]