Display Symbol Table of Compiled Code

DESCRIPTION:

Displays the symbol table of compiled code in object, executable, or library files.

USAGE:

<B>Splus NM files ...</B> 

REQUIRED ARGUMENTS:

files
names of files containing compiled code. Typically these are ".o" files that were compiled from C, Fortran, or RATFOR, ".a" files containing libraries of ".o" files, or executable files created by the linker from ".o" and ".a" files.

DETAILS:

The NM utility is useful to determine where a symbol (a function or data name) is defined and where it is referenced. It may be used to diagnose duplicate symbol or undefined symbol problems reported by dyn.load, dyn.load2, or LOAD.

NM simply reformats the information presented by the nm command to make it look like the output of nm on BSD-like versions of Unix. Each line of output will contain the name of the file examined, the value of the symbol (the size of common symbols, the address of other types), the type code for the symbol, and the name of the symbol. There will be one line for each externally visible symbol. The type U (undefined) means that it is referenced and other types, T (text, i.e. function or subroutine), D (initialized data), and B, (uninitialized data) mean that it is defined. The type C (common) means that it is tentatively defined; you may see this for uninitialized data in object files but it will be replaced by D or B in the executable file made from those object files (the value of a common symbol is its size).

You should filter the output of NM with the Unix command grep to print just the lines of interest.

Many compilers will add leading or trailing underscores to the names your C or Fortran code uses to produce the symbol names.

NOTE:

The exact format of the lines output by NM depends on the version of Unix. The same information will be present but some versions separate fields with a colon and some with a space. Some may give the value of an undefined symbol as 0 while most leave that field blank for undefined symbols.

SEE ALSO:

, , , , .

EXAMPLES:

% \fBSplus NM /usr/lib/libc.a /usr/lib/libm.a | grep j0\fP 
/usr/lib/libm.a:d_bessel_.o:00000000 T _d_j0_ 
/usr/lib/libm.a:d_bessel_.o:         U _j0 
/usr/lib/libm.a:r_bessel_.o:         U _j0 
/usr/lib/libm.a:r_bessel_.o:00000000 T _r_j0_ 
/usr/lib/libm.a:bessel.o:00000000 T _j0 
# j0 is defined by bessel.o in the math library (and used by two other 
# files in that library) so you need to use the linker flag -lm to 
# use j0.