nm(1) DG/UX R4.11MU05 nm(1)
NAME
nm - print name list of common object file
SYNOPSIS
nm [-oxhvneurplVT] file ...
DESCRIPTION
The nm command displays the symbol table of each ELF or COFF object
file specified. The file may be a relocatable or absolute ELF or
COFF object file, or it may be an archive of relocatable or absolute
ELF or COFF object files.
The information reported by nm differs in the ELF and COFF
environments. In an ELF environment, nm prints the following:
Index The index of the symbol (the index appears in brackets).
Value The value of the symbol is one of the following: a section
offset for defined symbols in a relocatable file; alignment
constraints for symbols whose section index is SHNCOMMON; a
virtual address in executable and dynamic library files.
Size The size in bytes of the associated object.
Type A symbol is of one of the following types: NOTYPE (no type was
specified), OBJECT (a data object such as an array or
variable), FUNC (a function or other executable code), SECTION
(a section symbol), or FILE (name of the source file).
Bind The symbol's binding attributes. LOCAL symbols have a scope
limited to the object file containing their definition; GLOBAL
symbols are visible to all object files being combined; and
WEAK symbols are essentially global symbols with a lower
precedence than GLOBAL.
Other A field reserved for future use, currently containing 0.
Shndx Except for three special values, this is the section header
table index in relation to which the symbol is defined. The
following special values exist: ABS indicates the symbol's
value will not change through relocation; COMMON indicates an
unallocated block and the value provides alignment
constraints; and UNDEF indicates an undefined symbol.
Name The name of the symbol.
In a COFF environment, nm prints the following:
Name The name of the symbol.
Value The symbol's value expressed as an offset or an address
depending on its storage class.
Class The symbol's storage class.
Type The symbol's 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 file must have been compiled with the -g option
of the cc(1) command for this information to appear.
Size The symbol's size in bytes, if available. Note that the file
must have been compiled with the -g option of the cc(1)
command for this information to appear.
Line The source line number at which the symbol is defined, if
available. Note that the file must have been compiled with
the -g option of the cc(1) command for this information to
appear.
Section For storage classes static and external, the object file
section containing the symbol (e.g., text, data or bss).
These options control the output of nm:
-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.
-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 symbol), D (data
symbol), S (section symbol), R (register symbol), F (file
symbol), C (common symbol), or N (symbol has no type). If the
symbol is local (non-external), the type letter is in lower
case.
-V Print, on standard error, the version of nm being executed.
This option is accepted only in an ELF environment:
-l Distinguish between WEAK and GLOBAL symbols by appending a *
to the key letter for WEAK symbols.
These options are meaningful only in a COFF environment (they are
ignored in an ELF environment):
-e Print only external and static symbols.
-T By default, nm prints the entire name of each symbol. Since
object files can have symbol 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
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 nm name
-e -v and nm -ve name print the static and external symbols in name,
with external symbols sorted by value.
FILES
TMPDIR/* temporary files
TMPDIR is usually /usr/tmp but can be redefined by
setting the environment variable TMPDIR [see tmpnam()
in tmpnam(3S)].
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.
SEE ALSO
as(1), cc(1), ld(1), tmpnam(3S), a.out(4), ar(4).
CAVEAT
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.
Licensed material--property of copyright holder(s)