DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

nm(CP)


nm -- print name list of an object file

Synopsis

   nm [-goxhtnvsnurplCVAPR] 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''
This field currently indicates the visibility of the symbol. 0 indicates default visibility. ``HIDDEN'' means the symbol is visible solely within the object but not exported to other objects. ``PROT'' means the symbol is "protected." Any reference to the symbol from within the object will go to this definition, even if other definitions are present and would normally take precedence.


``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:


-g
Only print symbols with binding types GLOBAL and WEAK.

-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.

-t d | o | x
Set output format to decimal, octal or hexadecimal. (Decimal is the default; -t o is equivalent to -o; -t x is equivalent to -x)


-h
Do not display the output heading data.


-v
Sort external symbols by value before they are printed.

-s
Print section names instead of section indices.


-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 symbol name. This option is ignored if -P is specified.

-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 symbol reference), ``A'' (absolute symbol) ``B'' (symbol defined in .bss or a common symbol) ``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.

-A
Prepend the name of the object file and archive to each output line.

-P [-l]
Alternate form of terse, easily parseable output (see -p). The symbol name appears first, followed by a keyletter (as described under -p), the symbol's value and its size. The value and size fields are printed in hexadecimal, by default.

-R
Prepend the name of the object file and archive to each symbol name. This option is ignored if -P is specified.

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(F), ar(F), as(C), cc(C), dump(C), ld(C)


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005