nm(1)


nm -- print name list of an object file

Synopsis

   nm [-oxhvnurplCV] files 

Description

The nm command displays the symbol table of each ELF or COFF object file, specified by file(s). 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. For each symbol, the following information will be printed:

``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 ``SHN_COMMON''; 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.

The output of nm may be controlled using the following 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 heading 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 [-l]
Produce terse output that can be parsed easily. Each symbol name is preceded by its value (blanks if undefined) and one of the letters ``U'' (undefined), ``N'' (symbol has no type), ``D'' (data object symbol), ``T'' (text symbol), ``S'' (section symbol), or ``F'' (file symbol). If the symbol's binding attribute is ``LOCAL'', the key letter is lower case; if the symbol's binding attribute is ``WEAK'', the key letter is upper case (if the -l modifier is specified, the upper case key letter is followed by an ``*''); if the symbol's binding attribute is ``GLOBAL'', the key letter is upper case.

-C
Print C++ names decoded.

-V
Print on the standard error output the version number of the nm command being executed.

Options may be used in any order, either singly or in combination, and may appear anywhere in the command line. When conflicting options are specified (such as nm -v -n) the first is taken and the second ignored with a warning message to the user.

References

a.out(4), ar(4), as(1), cc(1), dump(1), ld(1)


30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.