NM(1) — UNIX Programmer’s Manual
NAME
nm − print name list
SYNOPSIS
nm [ −agnoprumxjl[s segname sectname] ] [ file ... ]
DESCRIPTION
Nm prints the name list (symbol table) of each object file in the argument list. If an argument is an archive, a listing for each object file in the archive will be produced. File can be of the form libx.a(x.o) and then only symbols from that member of the object file are listed (the ()’s have to be quoted to get by the shell). If no file is given, the symbols in "a.out" are listed.
Each symbol name is preceded by its value (blanks if undefined). Then if the −m option is not specified one of the letters U (undefined), A (absolute), T (text section symbol), D (data section symbol), B (bss section symbol), C (common symbol), f file name, − for debugger symbol table entries (see −a below), S (symbol in a section other than those above) or I (indirect symbol) is printed for the symbol type. If the symbol is local (non-external) the type letter is in lower case.
If the symbol is a Objective-C method the symbol name is ±[Class_name(category_name) where a ‘+’ is used for class methods and a ‘−’ is used for instance methods and (category_name) is only printed if the method is in a category.
The output is sorted alphabetically by default.
Options are:
−a Print all symbol table entries including those inserted for use by debuggers.
−g Print only global (external) symbols.
−n Sort numerically rather than alphabetically.
−o Prepend file or archive element name to each output line rather than only once.
−p Don’t sort; print in symbol-table order.
−r Sort in reverse order.
−u Print only undefined symbols.
−m Print the N_SECT type symbols (Mach-O symbols) as (segment_name, section_name) followed by either external or non-external and then the symbol name. Also undefined, common, absolute and indirect symbols get printed as (undefined), (common) (absolute) and (indirect) respectively.
−x Print the symbol table entry’s fields in hex along with the name as a string.
−j Just print the symbol names (no value or type).
−s segname sectname
List only those symbols in the section (segname,sectname).
−l List a pseudo symbol .section_start if no symbol has the value of the start of the section (used with the −s option above).
SEE ALSO
ar(1), ar(5), Mach-O(5), stab(5), nlist(3)
BUGS
Printing Mach-O symbols with −m is too verbose. Without the −m symbols in the Objective-C sections type’s get printed as an ‘s’.
NeXT Computer, Inc. — October 22, 1991