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