ranlib: fix it
[odcctools-svp.git] / man / nm.1
blob2abe0d01b914de9a48111a3c4fb7bc28f976e0f4
1 .TH NM 1 "July 28, 2005" "Apple Computer, Inc."
2 .SH NAME
3 nm \- display name list (symbol table)
4 .SH SYNOPSIS
5 .B nm
7 .B \-agnoprumxjlfPA
9 .B s 
10 .I segname sectname
13 .B \-
14 ] [
15 .BI \-t " format"
16 ] [[
17 .BI \-arch " arch_flag
18 ]...] [
19 .IR file " ... ]"
20 .SH DESCRIPTION
21 .I Nm
22 displays the name list (symbol table) of each object
23 .I file
24 in the argument list.  If an argument is an archive, a listing for each object
25 file in the archive will be produced.  
26 .I File
27 can be of the form libx.a(x.o), in which case only symbols from that member of the
28 object file are listed.  
29 (The parentheses have to be quoted to get by the shell.)
30 If no
31 .I file
32 is given, the symbols in 
33 .I a.out 
34 are listed.
35 .PP
36 Each symbol name is preceded by its value (blanks if undefined).
37 Unless the
38 .B \-m
39 option is specified, this value is followed by one of the following
40 characters, representing the symbol type:
41 .SM
42 .B U
43 (undefined),
44 .SM
45 .B A
46 (absolute),
47 .SM
48 .B  T
49 (text section symbol),
50 .SM
51 .B D
52 (data section symbol),
53 .SM
54 .B B
55 (bss section symbol),
56 .SM
57 .B C
58 (common symbol),
59 .SM
60 .B \-
61 (for debugger symbol table entries; see
62 .B \-a
63 below),
64 .SM
65 .B S
66 (symbol in a section other than those above),
68 .SM
69 .B I
70 (indirect symbol).
71 If the symbol is local (non-external), the symbol's type is
72 instead represented by the corresponding
73 lowercase letter.  A lower case
74 .B u
75 in a dynamic shared library indicates a undefined reference to a private
76 external in another module in the same library.
77 .PP
78 If the symbol is a Objective C method, the symbol name is
79 .BI \(+-[ "Class_name(category_name)" " " "method:name:" "]\fR,"
80 where `+' is for class methods, `\-' is for instance methods,
81 and
82 .I (category_name)
83 is present only when the method is in a category.
84 .PP
85 The output is sorted alphabetically by default.
86 .PP
87 Options are:
88 .TP
89 .B  \-a
90 Display all symbol table entries, 
91 including those inserted for use by debuggers.
92 .TP
93 .B  \-g
94 Display only global (external) symbols.
95 .TP
96 .B \-n
97 Sort numerically rather than alphabetically.
98 .TP
99 .B  \-o
100 Prepend file or archive element name to each output line, 
101 rather than only once.
103 .B  \-p
104 Don't sort; display in symbol-table order.
106 .B  \-r
107 Sort in reverse order.
109 .B  \-u
110 Display only undefined symbols.
112 .B  \-m
113 Display the N_SECT type symbols (Mach-O symbols) as
114 .RI ( "segment_name, section_name" )
115 followed by either
116 .I external
118 .I non-external
119 and then the symbol name.
120 Undefined, common, absolute and indirect symbols get displayed as
121 .IR (undefined) ,
122 .IR (common) ,
123 .IR (absolute) ,
125 .IR (indirect) ,
126 respectively.
128 .B \-x
129 Display the symbol table entry's fields in hexadecimal,
130 along with the name as a string.
132 .B \-j
133 Just display the symbol names (no value or type).
135 .BI \-s " segname sectname"
136 List only those symbols in the section
137 .I (segname,sectname).
139 .B \-l
140 List a pseudo symbol
141 .I ".section_start"
142 if no symbol has as its value the starting address of the section. 
143 (This is used with the
144 .B \-s
145 option above.)
147 .BI \-arch " arch_type"
148 Specifies the architecture,
149 .I arch_type,
150 of the file for
151 .IR nm (1)
152 to operate on when the file is a universal file (see
153 .IR arch (3)
154 for the currently known
155 .IR arch_type s).
157 .I arch_type
158 can be "all" to operate on all architectures in the file.
159 The default is to display the symbols from only the host architecture,
160 if the file contains it;
161 otherwise, symbols for all architectures in the file
162 are displayed.
164 .B \-f
165 Display the symbol table of a dynamic library flat (as one file not separate
166 modules).
168 .B \-A
169 Write the pathname or library name of an object on each line.
171 .B \-P
172 Write information in a portable output format.
174 .BI \-t " format"
175 For the
176 .B \-P
177 output, write the numeric value in the specified format. The format shall be
178 dependent on the single character used as the format option-argument:
180 .I d
181 The value shall be written in decimal (default).
183 .I o
184 The value shall be written in octal.
186 .I x
187 The value shall be written in hexadecimal.
188 .SH SEE ALSO
189 ar(1), ar(5), Mach-O(5), stab(5), nlist(3)
190 .SH BUGS
191 Displaying Mach-O symbols with
192 .B \-m
193 is too verbose.  Without the 
194 .BR \-m ,
195 symbols in the Objective C sections get displayed as an `s'.