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