]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/elftoolchain/nm/nm.1
Initial import from vendor-sys branch of openzfs
[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 3642 2018-10-14 14:24:28Z jkoshy $
26 .\"
27 .Dd September 13, 2017
28 .Dt NM 1
29 .Os
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 -extern-only
40 .Op Fl -help
41 .Op Fl -line-numbers
42 .Op Fl -no-demangle
43 .Op Fl -no-sort
44 .Op Fl -numeric-sort
45 .Op Fl -print-armap
46 .Op Fl -print-file-name
47 .Op Fl -print-size
48 .Op Fl -radix= Ns Ar format
49 .Op Fl -reverse-sort
50 .Op Fl -size-sort
51 .Op Fl -undefined-only
52 .Op Fl -version
53 .Op Fl A
54 .Op Fl B
55 .Op Fl C Op Ar style
56 .Op Fl D
57 .Op Fl P
58 .Op Fl V
59 .Op Fl a
60 .Op Fl e
61 .Op Fl g
62 .Op Fl h
63 .Op Fl l
64 .Op Fl n
65 .Op Fl o
66 .Op Fl p
67 .Op Fl r
68 .Op Fl S
69 .Op Fl s
70 .Op Fl t Ar format
71 .Op Fl u
72 .Op Fl x
73 .Ar
74 .Sh DESCRIPTION
75 The
76 .Nm
77 utility displays symbolic information in the object files,
78 executables, and object library files named by its arguments.
79 Lack of symbolic information in an otherwise valid input
80 file, is not considered to be an error.
81 If no files are specified on the command line,
82 .Nm
83 will attempt to read
84 .Pa a.out .
85 .Pp
86 The
87 .Nm
88 utility recognizes the following options:
89 .Bl -tag -width ".Fl d Ar argument"
90 .It Fl -debug-syms
91 Display all symbols, including debugger-only symbols.
92 .It Fl -defined-only
93 Display only defined symbols.
94 .It Fl -demangle Ns Op = Ns Ar style
95 Decode (demangle) low-level symbol names into human-readable names.
96 Supported values for argument
97 .Ar style
98 are
99 .Sq auto ,
100 .Sq gnu-v2 ,
101 .Sq gnu-v3
102 and
103 .Sq arm.
104 If argument
105 .Ar style
106 is not specified, it is taken to be
107 .Sq auto .
108 .It Fl -dynamic
109 Only display dynamic symbols.
110 This option is only meaningful for shared libraries.
111 .It Fl -extern-only
112 Only display information about global (external) symbols.
113 .It Fl -help
114 Display a help message and exit.
115 .It Fl -format Ns = Ns Ar format
116 Display output in the format specified by argument
117 .Ar format .
118 Supported values for the format argument are
119 .Sq bsd ,
120 .Sq sysv ,
121 and
122 .Sq posix .
123 The default output format is
124 .Sq bsd .
125 .It Fl -line-numbers
126 Display the filename and line number associated a symbol using
127 any debugging information present in the input file.
128 For defined symbols, look up the line number associated with
129 the address of the symbol.
130 For undefined symbols, look up the line number associated with
131 a relocation entry that refers to the symbol.
132 If line number information can be determined, it is displayed after
133 other symbol information.
134 .It Fl -no-demangle
135 Do not demangle symbol names (default).
136 .It Fl -no-sort
137 Do not sort symbols.
138 .It Fl -numeric-sort
139 Sort symbols numerically by address instead of alphabetically by name.
140 .It Fl -print-armap
141 For
142 .Xr ar 1
143 archives, include the index of the archive's members.
144 .It Fl -print-file-name
145 Write the full pathname or library name of an object on each line,
146 before the rest of the information for a symbol.
147 If this option is not specified,
148 .Nm
149 will only identify an input file once, before its symbols are
150 listed.
151 .It Fl -print-size
152 Print the size of each symbol instead of its value.
153 .It Fl -radix Ns = Ns Ar radix
154 Print numeric values using the specified radix.
155 Supported values for argument
156 .Ar radix
157 are
158 .Sq d
159 for decimal,
160 .Sq o
161 for octal, and
162 .Sq x
163 for hexadecimal.
164 .It Fl -reverse-sort
165 Reverse the order of the sort.
166 .It Fl -size-sort
167 Sort symbols by size instead of alphabetically by name.
168 .It Fl -undefined-only
169 Display only undefined symbols.
170 .It Fl -version
171 Display the version identifier for
172 .Nm
173 and exit.
174 .It Fl A
175 Equivalent to specifying option
176 .Fl -print-file-name .
177 .It Fl B
178 Equivalent to specifying option
179 .Fl -format= Ns Ar bsd .
180 .It Fl C Op Ar style
181 Equivalent to specifying option
182 .Fl -demangle Ns Op = Ns Ar style .
183 .It Fl D
184 Equivalent to specifying option
185 .Fl -dynamic .
186 .It Fl F Ar format
187 Equivalent to specifying option
188 .Fl -format Ns = Ns Ar format .
189 .It Fl P
190 Equivalent to specifying option
191 .Fl -format Ns = Ns Ar posix .
192 .It Fl S
193 Equivalent to specifying option
194 .Fl -print-size .
195 .It Fl V
196 Equivalent to specifying option
197 .Fl -version .
198 .It Fl a
199 Equivalent to specifying option
200 .Fl -debug-syms .
201 .It Fl e
202 Only display information for global and static symbols.
203 .It Fl f
204 Produce full output (default).
205 .It Fl g
206 Equivalent to specifying option
207 .Fl -extern-only .
208 .It Fl h
209 Equivalent to specifying option
210 .Fl -help .
211 .It Fl l
212 Equivalent to specifying option
213 .Fl -line-numbers .
214 .It Fl n
215 Equivalent to specifying option
216 .Fl -numeric-sort .
217 .It Fl o
218 If POSIX output was specified using the
219 .Fl F Ar posix
220 or
221 .Fl P
222 options, this option is equivalent to specifying
223 .Fl -radix Ns = Ns Sq Ar o .
224 If POSIX output was not specified, this option
225 acts as a synonym for the
226 .Fl -print-file-name
227 option.
228 .It Fl p
229 Equivalent to specifying option
230 .Fl -no-sort .
231 .It Fl v
232 Equivalent to option
233 .Fl n .
234 .It Fl r
235 Equivalent to specifying option
236 .Fl -reverse-sort
237 .It Fl s
238 Equivalent to specifying option
239 .Fl -print-armap .
240 .It Fl t Ar radix
241 Equivalent to specifying option
242 .Fl -radix= Ns Ar radix .
243 .It Fl u
244 Equivalent to specifying option
245 .Fl -undefined-only .
246 .It Fl x
247 Write numeric values in hexadecimal (equivalent to -t x).
248 .El
249 .Sh OUTPUT FORMAT
250 .Pp
251 The
252 .Nm
253 utility can present its information in a number of formats, numeric
254 radices and sort orders.
255 By default
256 .Nm
257 uses BSD style output, a hexadecimal radix, without output sorted
258 alphabetically by name and without demangling of names.
259 .Pp
260 For each symbol listed,
261 .Nm
262 presents the following information:
263 .Bl -bullet -compact
264 .It
265 The library or object name, if options
266 .Fl A
267 or
268 .Fl -print-file-name
269 were specified.
270 .It
271 The symbol name.
272 .It
273 The type of the symbol denoted by a single character as below:
274 .Bl -tag -compact -width indent
275 .It A
276 A global, absolute symbol.
277 .It B
278 A global
279 .Dq bss
280 (uninitialized data) symbol.
281 .It C
282 A
283 .Dq common
284 symbol, representing uninitialized data.
285 .It D
286 A global symbol naming initialized data.
287 .It N
288 A debugger symbol.
289 .It R
290 A read-only data symbol.
291 .It T
292 A global text symbol.
293 .It U
294 An undefined symbol.
295 .It V
296 A weak object.
297 .It W
298 A weak reference.
299 .It a
300 A local absolute symbol.
301 .It b
302 A local
303 .Dq bss
304 (uninitialized data) symbol.
305 .It d
306 A local data symbol.
307 .It r
308 A local read-only data symbol.
309 .It t
310 A local text symbol.
311 .It v
312 A weak object that is undefined.
313 .It w
314 A weak symbol that is undefined.
315 .It ?
316 None of the above.
317 .El
318 .It
319 The value of the symbol.
320 .It
321 The size of the symbol if applicable.
322 .It
323 Line number information, if available and if options
324 .Fl l
325 or
326 .Fl -line-numbers
327 were specified.
328 .El
329 .Sh EXIT STATUS
330 .Ex -std
331 .Sh SEE ALSO
332 .Xr ar 1 ,
333 .Xr objdump 1 ,
334 .Xr ranlib 1 ,
335 .Xr elf 3
336 .Sh AUTHORS
337 The
338 .Nm
339 utility and this manual page were written by
340 .An Hyogeol Lee Aq Mt hyogeollee@gmail.com .