Viewing Symbols in an Object file with nm(1)

The nm(1) command displays the symbol table of each specified object. The file can be a relocatable object file or an executable object file, or an archive of relocatable or executable object files.

The nm command provides three general output formats: the default (neither -pnor -Pspecified), -p, and -P. See the nm(1) man page for a detailed description of the output formats.

To do this

Use the option

 

 

Prefix each output line with the name of the object file or archive file. Equivalent to

-A

-r.

 

 

 

Demangle C++ names before printing them.

-C

 

 

Display the value and size of a symbol in decimal. This is the default for the default

-d

format or the -pformat. Equivalent to -td.

 

 

 

Display only external and static symbols. This option is ignored (see -f).

-e

 

 

Display full output. This option is in force by default.

-f

 

 

Display only external (global) symbol information.

-g

 

 

Do not display the output header data.

-h

 

 

Distinguish between weak and global symbols by appending * to the key letter of

-l

weak symbols. Only takes effect with -pand/or -P.

 

 

 

Sort symbols by name, in ascending collation order before they are printed. This is

-n

the default. To turn off this option, use -N.

 

 

 

Display symbols in the order in which they appear in the symbol table.

-N

 

 

Display the value and size of a symbol in octal. Equivalent to -t o.

-o

 

 

Display information in a blank-separated output format. Each symbol name is preceded

 

by its value (blanks if undefined) and one of the letters. Lower case letters indicate

 

local values. Upper case letters indicate global values.

 

absolute

 

a, A

 

bss symbol

 

b, B

 

common symbol

 

c, C

 

data symbol

 

d, D

-p

 

milli symbol

 

m, M

 

no type

 

n, N

 

section region

 

r, R

 

text symbol

 

t, T

 

undefined symbol

 

u, U

 

 

 

Display information in a portable output format to standard output. See the nm(1)

-P

manpage for format information. Note that -pis not compatible with -P.

 

 

 

56 Linker Tools for Itanium-Based Systems