]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/elftoolchain/nm/nm.1
MFV r272851:
[FreeBSD/FreeBSD.git] / contrib / elftoolchain / nm / nm.1
1 .\" Copyright (c) 2007 Hyogeol Lee <hyogeollee@gmail.com>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer
9 .\"    in this position and unchanged.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 .\"
25 .\" $Id: nm.1 2377 2012-01-03 07:10:59Z jkoshy $
26 .\"
27 .Dd January 3, 2012
28 .Os
29 .Dt NM 1
30 .Sh NAME
31 .Nm nm
32 .Nd display symbolic information in object files
33 .Sh SYNOPSIS
34 .Nm
35 .Op Fl -debug-syms
36 .Op Fl -defined-only
37 .Op Fl -demangle Ns Op = Ns style
38 .Op Fl -dynamic
39 .Op Fl -help
40 .Op Fl -line-numbers
41 .Op Fl -no-demangle
42 .Op Fl -no-sort
43 .Op Fl -numeric-sort
44 .Op Fl -print-armap
45 .Op Fl -print-file-name
46 .Op Fl -print-size
47 .Op Fl -radix= Ns Ar format
48 .Op Fl -reverse-sort
49 .Op Fl -size-sort
50 .Op Fl -undefined-only
51 .Op Fl -version
52 .Op Fl A
53 .Op Fl B
54 .Op Fl C Op Ar style
55 .Op Fl D
56 .Op Fl P
57 .Op Fl V
58 .Op Fl a
59 .Op Fl e
60 .Op Fl g
61 .Op Fl h
62 .Op Fl l
63 .Op Fl n
64 .Op Fl o
65 .Op Fl p
66 .Op Fl r
67 .Op Fl S
68 .Op Fl s
69 .Op Fl t Ar format
70 .Op Fl u
71 .Op Fl x
72 .Ar
73 .Sh DESCRIPTION
74 The
75 .Nm
76 utility displays symbolic information in the object files,
77 executables, and object library files named by its arguments.
78 Lack of symbolic information in an otherwise valid input
79 file, is not considered to be an error.
80 If no files are specified on the command line,
81 .Nm
82 will attempt to read
83 .Pa a.out .
84 .Pp
85 The
86 .Nm
87 utility recognizes the following options:
88 .Bl -tag -width ".Fl d Ar argument"
89 .It Fl -debug-syms
90 Display all symbols, including debugger-only symbols.
91 .It Fl -defined-only
92 Display only defined symbols.
93 .It Fl -demangle Ns Op = Ns Ar style
94 Decode (demangle) low-level symbol names into human-readable names.
95 Supported values for argument
96 .Ar style
97 are
98 .Sq auto ,
99 .Sq gnu-v2 ,
100 .Sq gnu-v3
101 and
102 .Sq arm.
103 If argument
104 .Ar style
105 is not specified, it is taken to be
106 .Sq auto .
107 .It Fl -dynamic
108 Only display dynamic symbols.
109 This option is only meaningful for shared libraries.
110 .It Fl -help
111 Display a help message and exit.
112 .It Fl -format Ns = Ns Ar format
113 Display output in the format specified by argument
114 .Ar format .
115 Supported values for the format argument are
116 .Sq bsd ,
117 .Sq sysv ,
118 and
119 .Sq posix .
120 The default output format is
121 .Sq bsd .
122 .It Fl -line-numbers
123 Display the filename and line number associated a symbol using
124 any debugging information present in the input file.
125 For defined symbols, look up the line number associated with
126 the address of the symbol.
127 For undefined symbols, look up the line number associated with
128 a relocation entry that refers to the symbol.
129 If line number information can be determined, it is displayed after
130 other symbol information.
131 .It Fl -no-demangle
132 Do not demangle symbol names (default).
133 .It Fl -no-sort
134 Do not sort symbols.
135 .It Fl -numeric-sort
136 Sort symbols numerically by address instead of alphabetically by name.
137 .It Fl -print-armap
138 For
139 .Xr ar 1
140 archives, include the index of the archive's members.
141 .It Fl -print-file-name
142 Write the full pathname or library name of an object on each line,
143 before the rest of the information for a symbol.
144 If this option is not specified,
145 .Nm
146 will only identify an input file once, before its symbols are
147 listed.
148 .It Fl -print-size
149 Print the size of each symbol instead of its value.
150 .It Fl -radix Ns = Ns Ar radix
151 Print numeric values using the specified radix.
152 Supported values for argument
153 .Ar radix
154 are
155 .Sq d
156 for decimal,
157 .Sq o
158 for octal, and
159 .Sq x
160 for hexadecimal.
161 .It Fl -reverse-sort
162 Reverse the order of the sort.
163 .It Fl -size-sort
164 Sort symbols by size instead of alphabetically by name.
165 .It Fl -undefined-only
166 Display only undefined symbols.
167 .It Fl -version
168 Display the version identifier for
169 .Nm
170 and exit.
171 .It Fl A
172 Equivalent to specifying option
173 .Fl -print-file-name .
174 .It Fl B
175 Equivalent to specifying option
176 .Fl -format= Ns Ar bsd .
177 .It Fl C Op Ar style
178 Equivalent to specifying option
179 .Fl -demangle Ns Op = Ns Ar style .
180 .It Fl D
181 Equivalent to specifying option
182 .Fl -dynamic .
183 .It Fl F Ar format
184 Equivalent to specifying option
185 .Fl -format Ns = Ns Ar format .
186 .It Fl P
187 Equivalent to specifying option
188 .Fl -format Ns = Ns Ar posix .
189 .It Fl S
190 Equivalent to specifying option
191 .Fl -print-size .
192 .It Fl V
193 Equivalent to specifying option
194 .Fl -version .
195 .It Fl a
196 Equivalent to specifying option
197 .Fl -debug-syms .
198 .It Fl e
199 Only display information for global and static symbols.
200 .It Fl f
201 Produce full output (default).
202 .It Fl g
203 Only display information about global (external) symbols.
204 .It Fl h
205 Equivalent to specifying option
206 .Fl -help .
207 .It Fl l
208 Equivalent to specifying option
209 .Fl -line-numbers .
210 .It Fl n
211 Equivalent to specifying option
212 .Fl -numeric-sort .
213 .It Fl o
214 If POSIX output was specified using the
215 .Fl F Ar posix
216 or
217 .Fl P
218 options, this option is equivalent to specifying
219 .Fl -radix Ns = Ns Sq Ar o .
220 If POSIX output was not specified, this option
221 acts as a synonym for the
222 .Fl -print-file-name
223 option.
224 .It Fl p
225 Equivalent to specifying option
226 .Fl -no-sort .
227 .It Fl v
228 Equivalent to option
229 .Fl n .
230 .It Fl r
231 Equivalent to specifying option
232 .Fl -reverse-sort
233 .It Fl s
234 Equivalent to specifying option
235 .Fl -print-armap .
236 .It Fl t Ar radix
237 Equivalent to specifying option
238 .Fl -radix= Ns Ar radix .
239 .It Fl u
240 Equivalent to specifying option
241 .Fl -undefined-only .
242 .It Fl x
243 Write numeric values in hexadecimal (equivalent to -t x).
244 .El
245 .Sh OUTPUT FORMAT
246 .Pp
247 The
248 .Nm
249 utility can present its information in a number of formats, numeric
250 radices and sort orders.
251 By default
252 .Nm
253 uses BSD style output, a hexadecimal radix, without output sorted
254 alphabetically by name and without demangling of names.
255 .Pp
256 For each symbol listed,
257 .Nm
258 presents the following information:
259 .Bl -bullet -compact
260 .It
261 The library or object name, if options
262 .Fl A
263 or
264 .Fl -print-file-name
265 were specified.
266 .It
267 The symbol name.
268 .It
269 The type of the symbol denoted by a single character as below:
270 .Bl -tag -compact -width indent
271 .It A
272 A global, absolute symbol.
273 .It B
274 A global
275 .Dq bss
276 (uninitialized data) symbol.
277 .It C
278 A
279 .Dq common
280 symbol, representing uninitialized data.
281 .It D
282 A global symbol naming initialized data.
283 .It N
284 A debugger symbol.
285 .It R
286 A read-only data symbol.
287 .It T
288 A global text symbol.
289 .It U
290 An undefined symbol.
291 .It V
292 A weak object.
293 .It W
294 A weak reference.
295 .It a
296 A local absolute symbol.
297 .It b
298 A local
299 .Dq bss
300 (uninitialized data) symbol.
301 .It d
302 A local data symbol.
303 .It t
304 A local text symbol.
305 .It v
306 A weak object that is undefined.
307 .It w
308 A weak symbol that is undefined.
309 .It ?
310 None of the above.
311 .El
312 .It
313 The value of the symbol.
314 .It
315 The size of the symbol if applicable.
316 .It
317 Line number information, if available and if options
318 .Fl l
319 or
320 .Fl -line-numbers
321 were specified.
322 .El
323 .Sh EXIT STATUS
324 .Ex -std
325 .Sh SEE ALSO
326 .Xr ar 1 ,
327 .Xr objdump 1 ,
328 .Xr ranlib 1 ,
329 .Xr elf 3
330 .Sh AUTHORS
331 The
332 .Nm
333 utility and this manual page were written by
334 .An Hyogeol Lee Aq hyogeollee@gmail.com .