1NM(1) GNU Development Tools NM(1)
2
3
4
6 nm - list symbols from object files
7
9 nm [-A|-o|--print-file-name]
10 [-a|--debug-syms]
11 [-B|--format=bsd]
12 [-C|--demangle[=style]]
13 [-D|--dynamic]
14 [-fformat|--format=format]
15 [-g|--extern-only]
16 [-h|--help]
17 [--ifunc-chars=CHARS]
18 [-j|--format=just-symbols]
19 [-l|--line-numbers] [--inlines]
20 [-n|-v|--numeric-sort]
21 [-P|--portability]
22 [-p|--no-sort]
23 [-r|--reverse-sort]
24 [-S|--print-size]
25 [-s|--print-armap]
26 [-t radix|--radix=radix]
27 [-u|--undefined-only]
28 [-U method] [--unicode=method]
29 [-V|--version]
30 [-X 32_64]
31 [--defined-only]
32 [--no-demangle]
33 [--no-recurse-limit|--recurse-limit]]
34 [--plugin name]
35 [--size-sort]
36 [--special-syms]
37 [--synthetic]
38 [--target=bfdname]
39 [--with-symbol-versions]
40 [--without-symbol-versions]
41 [objfile...]
42
44 GNU nm lists the symbols from object files objfile.... If no object
45 files are listed as arguments, nm assumes the file a.out.
46
47 For each symbol, nm shows:
48
49 • The symbol value, in the radix selected by options (see below), or
50 hexadecimal by default.
51
52 • The symbol type. At least the following types are used; others
53 are, as well, depending on the object file format. If lowercase,
54 the symbol is usually local; if uppercase, the symbol is global
55 (external). There are however a few lowercase symbols that are
56 shown for special global symbols ("u", "v" and "w").
57
58 "A" The symbol's value is absolute, and will not be changed by
59 further linking.
60
61 "B"
62 "b" The symbol is in the BSS data section. This section typically
63 contains zero-initialized or uninitialized data, although the
64 exact behavior is system dependent.
65
66 "C"
67 "c" The symbol is common. Common symbols are uninitialized data.
68 When linking, multiple common symbols may appear with the same
69 name. If the symbol is defined anywhere, the common symbols
70 are treated as undefined references. The lower case c
71 character is used when the symbol is in a special section for
72 small commons.
73
74 "D"
75 "d" The symbol is in the initialized data section.
76
77 "G"
78 "g" The symbol is in an initialized data section for small objects.
79 Some object file formats permit more efficient access to small
80 data objects, such as a global int variable as opposed to a
81 large global array.
82
83 "i" For PE format files this indicates that the symbol is in a
84 section specific to the implementation of DLLs.
85
86 For ELF format files this indicates that the symbol is an
87 indirect function. This is a GNU extension to the standard set
88 of ELF symbol types. It indicates a symbol which if referenced
89 by a relocation does not evaluate to its address, but instead
90 must be invoked at runtime. The runtime execution will then
91 return the value to be used in the relocation.
92
93 Note - the actual symbols display for GNU indirect symbols is
94 controlled by the --ifunc-chars command line option. If this
95 option has been provided then the first character in the string
96 will be used for global indirect function symbols. If the
97 string contains a second character then that will be used for
98 local indirect function symbols.
99
100 "I" The symbol is an indirect reference to another symbol.
101
102 "N" The symbol is a debugging symbol.
103
104 "n" The symbol is in the read-only data section.
105
106 "p" The symbol is in a stack unwind section.
107
108 "R"
109 "r" The symbol is in a read only data section.
110
111 "S"
112 "s" The symbol is in an uninitialized or zero-initialized data
113 section for small objects.
114
115 "T"
116 "t" The symbol is in the text (code) section.
117
118 "U" The symbol is undefined.
119
120 "u" The symbol is a unique global symbol. This is a GNU extension
121 to the standard set of ELF symbol bindings. For such a symbol
122 the dynamic linker will make sure that in the entire process
123 there is just one symbol with this name and type in use.
124
125 "V"
126 "v" The symbol is a weak object. When a weak defined symbol is
127 linked with a normal defined symbol, the normal defined symbol
128 is used with no error. When a weak undefined symbol is linked
129 and the symbol is not defined, the value of the weak symbol
130 becomes zero with no error. On some systems, uppercase
131 indicates that a default value has been specified.
132
133 "W"
134 "w" The symbol is a weak symbol that has not been specifically
135 tagged as a weak object symbol. When a weak defined symbol is
136 linked with a normal defined symbol, the normal defined symbol
137 is used with no error. When a weak undefined symbol is linked
138 and the symbol is not defined, the value of the symbol is
139 determined in a system-specific manner without error. On some
140 systems, uppercase indicates that a default value has been
141 specified.
142
143 "-" The symbol is a stabs symbol in an a.out object file. In this
144 case, the next values printed are the stabs other field, the
145 stabs desc field, and the stab type. Stabs symbols are used to
146 hold debugging information.
147
148 "?" The symbol type is unknown, or object file format specific.
149
150 • The symbol name. If a symbol has version information associated
151 with it, then the version information is displayed as well. If the
152 versioned symbol is undefined or hidden from linker, the version
153 string is displayed as a suffix to the symbol name, preceded by an
154 @ character. For example foo@VER_1. If the version is the default
155 version to be used when resolving unversioned references to the
156 symbol, then it is displayed as a suffix preceded by two @
157 characters. For example foo@@VER_2.
158
160 The long and short forms of options, shown here as alternatives, are
161 equivalent.
162
163 -A
164 -o
165 --print-file-name
166 Precede each symbol by the name of the input file (or archive
167 member) in which it was found, rather than identifying the input
168 file once only, before all of its symbols.
169
170 -a
171 --debug-syms
172 Display all symbols, even debugger-only symbols; normally these are
173 not listed.
174
175 -B The same as --format=bsd (for compatibility with the MIPS nm).
176
177 -C
178 --demangle[=style]
179 Decode (demangle) low-level symbol names into user-level names.
180 Besides removing any initial underscore prepended by the system,
181 this makes C++ function names readable. Different compilers have
182 different mangling styles. The optional demangling style argument
183 can be used to choose an appropriate demangling style for your
184 compiler.
185
186 --no-demangle
187 Do not demangle low-level symbol names. This is the default.
188
189 --recurse-limit
190 --no-recurse-limit
191 --recursion-limit
192 --no-recursion-limit
193 Enables or disables a limit on the amount of recursion performed
194 whilst demangling strings. Since the name mangling formats allow
195 for an infinite level of recursion it is possible to create strings
196 whose decoding will exhaust the amount of stack space available on
197 the host machine, triggering a memory fault. The limit tries to
198 prevent this from happening by restricting recursion to 2048 levels
199 of nesting.
200
201 The default is for this limit to be enabled, but disabling it may
202 be necessary in order to demangle truly complicated names. Note
203 however that if the recursion limit is disabled then stack
204 exhaustion is possible and any bug reports about such an event will
205 be rejected.
206
207 -D
208 --dynamic
209 Display the dynamic symbols rather than the normal symbols. This
210 is only meaningful for dynamic objects, such as certain types of
211 shared libraries.
212
213 -f format
214 --format=format
215 Use the output format format, which can be "bsd", "sysv", "posix"
216 or "just-symbols". The default is "bsd". Only the first character
217 of format is significant; it can be either upper or lower case.
218
219 -g
220 --extern-only
221 Display only external symbols.
222
223 -h
224 --help
225 Show a summary of the options to nm and exit.
226
227 --ifunc-chars=CHARS
228 When display GNU indirect function symbols nm will default to using
229 the "i" character for both local indirect functions and global
230 indirect functions. The --ifunc-chars option allows the user to
231 specify a string containing one or two characters. The first
232 character will be used for global indirect function symbols and the
233 second character, if present, will be used for local indirect
234 function symbols.
235
236 j The same as --format=just-symbols.
237
238 -l
239 --line-numbers
240 For each symbol, use debugging information to try to find a
241 filename and line number. For a defined symbol, look for the line
242 number of the address of the symbol. For an undefined symbol, look
243 for the line number of a relocation entry which refers to the
244 symbol. If line number information can be found, print it after
245 the other symbol information.
246
247 --inlines
248 When option -l is active, if the address belongs to a function that
249 was inlined, then this option causes the source information for all
250 enclosing scopes back to the first non-inlined function to be
251 printed as well. For example, if "main" inlines "callee1" which
252 inlines "callee2", and address is from "callee2", the source
253 information for "callee1" and "main" will also be printed.
254
255 -n
256 -v
257 --numeric-sort
258 Sort symbols numerically by their addresses, rather than
259 alphabetically by their names.
260
261 -p
262 --no-sort
263 Do not bother to sort the symbols in any order; print them in the
264 order encountered.
265
266 -P
267 --portability
268 Use the POSIX.2 standard output format instead of the default
269 format. Equivalent to -f posix.
270
271 -r
272 --reverse-sort
273 Reverse the order of the sort (whether numeric or alphabetic); let
274 the last come first.
275
276 -S
277 --print-size
278 Print both value and size of defined symbols for the "bsd" output
279 style. This option has no effect for object formats that do not
280 record symbol sizes, unless --size-sort is also used in which case
281 a calculated size is displayed.
282
283 -s
284 --print-armap
285 When listing symbols from archive members, include the index: a
286 mapping (stored in the archive by ar or ranlib) of which modules
287 contain definitions for which names.
288
289 -t radix
290 --radix=radix
291 Use radix as the radix for printing the symbol values. It must be
292 d for decimal, o for octal, or x for hexadecimal.
293
294 -u
295 --undefined-only
296 Display only undefined symbols (those external to each object
297 file).
298
299 -U [d|i|l|e|x|h]
300 --unicode=[default|invalid|locale|escape|hex|highlight]
301 Controls the display of UTF-8 encoded multibyte characters in
302 strings. The default (--unicode=default) is to give them no
303 special treatment. The --unicode=locale option displays the
304 sequence in the current locale, which may or may not support them.
305 The options --unicode=hex and --unicode=invalid display them as hex
306 byte sequences enclosed by either angle brackets or curly braces.
307
308 The --unicode=escape option displays them as escape sequences
309 (\uxxxx) and the --unicode=highlight option displays them as escape
310 sequences highlighted in red (if supported by the output device).
311 The colouring is intended to draw attention to the presence of
312 unicode sequences where they might not be expected.
313
314 -V
315 --version
316 Show the version number of nm and exit.
317
318 -X This option is ignored for compatibility with the AIX version of
319 nm. It takes one parameter which must be the string 32_64. The
320 default mode of AIX nm corresponds to -X 32, which is not supported
321 by GNU nm.
322
323 --defined-only
324 Display only defined symbols for each object file.
325
326 --plugin name
327 Load the plugin called name to add support for extra target types.
328 This option is only available if the toolchain has been built with
329 plugin support enabled.
330
331 If --plugin is not provided, but plugin support has been enabled
332 then nm iterates over the files in ${libdir}/bfd-plugins in
333 alphabetic order and the first plugin that claims the object in
334 question is used.
335
336 Please note that this plugin search directory is not the one used
337 by ld's -plugin option. In order to make nm use the linker plugin
338 it must be copied into the ${libdir}/bfd-plugins directory. For
339 GCC based compilations the linker plugin is called
340 liblto_plugin.so.0.0.0. For Clang based compilations it is called
341 LLVMgold.so. The GCC plugin is always backwards compatible with
342 earlier versions, so it is sufficient to just copy the newest one.
343
344 --size-sort
345 Sort symbols by size. For ELF objects symbol sizes are read from
346 the ELF, for other object types the symbol sizes are computed as
347 the difference between the value of the symbol and the value of the
348 symbol with the next higher value. If the "bsd" output format is
349 used the size of the symbol is printed, rather than the value, and
350 -S must be used in order both size and value to be printed.
351
352 --special-syms
353 Display symbols which have a target-specific special meaning.
354 These symbols are usually used by the target for some special
355 processing and are not normally helpful when included in the normal
356 symbol lists. For example for ARM targets this option would skip
357 the mapping symbols used to mark transitions between ARM code,
358 THUMB code and data.
359
360 --synthetic
361 Include synthetic symbols in the output. These are special symbols
362 created by the linker for various purposes. They are not shown by
363 default since they are not part of the binary's original source
364 code.
365
366 --with-symbol-versions
367 --without-symbol-versions
368 Enables or disables the display of symbol version information. The
369 version string is displayed as a suffix to the symbol name,
370 preceded by an @ character. For example foo@VER_1. If the version
371 is the default version to be used when resolving unversioned
372 references to the symbol then it is displayed as a suffix preceded
373 by two @ characters. For example foo@@VER_2. By default, symbol
374 version information is displayed.
375
376 --target=bfdname
377 Specify an object code format other than your system's default
378 format.
379
380 @file
381 Read command-line options from file. The options read are inserted
382 in place of the original @file option. If file does not exist, or
383 cannot be read, then the option will be treated literally, and not
384 removed.
385
386 Options in file are separated by whitespace. A whitespace
387 character may be included in an option by surrounding the entire
388 option in either single or double quotes. Any character (including
389 a backslash) may be included by prefixing the character to be
390 included with a backslash. The file may itself contain additional
391 @file options; any such options will be processed recursively.
392
394 ar(1), objdump(1), ranlib(1), and the Info entries for binutils.
395
397 Copyright (c) 1991-2022 Free Software Foundation, Inc.
398
399 Permission is granted to copy, distribute and/or modify this document
400 under the terms of the GNU Free Documentation License, Version 1.3 or
401 any later version published by the Free Software Foundation; with no
402 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
403 Texts. A copy of the license is included in the section entitled "GNU
404 Free Documentation License".
405
406
407
408binutils-2.38 2022-07-20 NM(1)