Kenwood HP 9000 Personal Computer User Manual


 
Chapter 4 109
Linker Tools
Viewing Symbols in an Object file with nm(1)
Examples
Display which object files have undefined references for the symbol
leap”:
"nm –rup *.o | grep leap"
Display which object files have a definition for the text symbol “leap”:
nm –rp *.o | awk ’{ if\
($3 == " "T" " && $4 == " "leap" ") { print $0 } }’"
To view the symbols defined in an object file, use the nm command.
The following 32-bit mode example shows output from running nm -p
on the func.o and main.o object files.
$ nm -p func.o
Other symbols created from compiling.
1073741824 d $THIS_DATA$
1073741824 d $THIS_SHORTDATA$
1073741824 b $THIS_BSS$
1073741824 d $THIS_SHORTBSS$
0000000000 T sum_n Global definitions of sum_n.
$ nm -p main.o
32-bit mode SOM files only: Truncate every name that would otherwise
overflow its column and place an asterisk as the last character in the
displayed name to mark it as truncated. If –A or –r is also specified, the file
prefix is truncated first.
By default, nm prints the entire name of the symbols listed. 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 overflows its
column, forcing every column after the name to be misaligned.
–T
Display undefined symbols only. –u
Print the usage menu. –U
Sort symbols by value before they are printed. –v
Display the executing version of the nm command on standard error. –V
Displays the value and size of a symbol in hexadecimal. this is the default
for the -P format. Equivalent to -t x.
-x
To
Use This
Option