1NM(1)                        GNU Development Tools                       NM(1)
2
3
4

NAME

6       nm - list symbols from object files
7

SYNOPSIS

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|--defined-only]
29          [-V|--version]
30          [-W|--no-weak]
31          [-X 32_64]
32          [--no-demangle]
33          [--no-recurse-limit|--recurse-limit]]
34          [--plugin name]
35          [--size-sort]
36          [--special-syms]
37          [--synthetic]
38          [--target=bfdname]
39          [--unicode=method]
40          [--with-symbol-versions]
41          [--without-symbol-versions]
42          [objfile...]
43

DESCRIPTION

45       GNU nm lists the symbols from object files objfile....  If no object
46       files are listed as arguments, nm assumes the file a.out.
47
48       For each symbol, nm shows:
49
50       •   The symbol value, in the radix selected by options (see below), or
51           hexadecimal by default.
52
53       •   The symbol type.  At least the following types are used; others
54           are, as well, depending on the object file format.  If lowercase,
55           the symbol is usually local; if uppercase, the symbol is global
56           (external).  There are however a few lowercase symbols that are
57           shown for special global symbols ("u", "v" and "w").
58
59           "A" The symbol's value is absolute, and will not be changed by
60               further linking.
61
62           "B"
63           "b" The symbol is in the BSS data section.  This section typically
64               contains zero-initialized or uninitialized data, although the
65               exact behavior is system dependent.
66
67           "C"
68           "c" The symbol is common.  Common symbols are uninitialized data.
69               When linking, multiple common symbols may appear with the same
70               name.  If the symbol is defined anywhere, the common symbols
71               are treated as undefined references.  The lower case c
72               character is used when the symbol is in a special section for
73               small commons.
74
75           "D"
76           "d" The symbol is in the initialized data section.
77
78           "G"
79           "g" The symbol is in an initialized data section for small objects.
80               Some object file formats permit more efficient access to small
81               data objects, such as a global int variable as opposed to a
82               large global array.
83
84           "i" For PE format files this indicates that the symbol is in a
85               section specific to the implementation of DLLs.
86
87               For ELF format files this indicates that the symbol is an
88               indirect function.  This is a GNU extension to the standard set
89               of ELF symbol types.  It indicates a symbol which if referenced
90               by a relocation does not evaluate to its address, but instead
91               must be invoked at runtime.  The runtime execution will then
92               return the value to be used in the relocation.
93
94               Note - the actual symbols display for GNU indirect symbols is
95               controlled by the --ifunc-chars command line option.  If this
96               option has been provided then the first character in the string
97               will be used for global indirect function symbols.  If the
98               string contains a second character then that will be used for
99               local indirect function symbols.
100
101           "I" The symbol is an indirect reference to another symbol.
102
103           "N" The symbol is a debugging symbol.
104
105           "n" The symbol is in a non-data, non-code, non-debug read-only
106               section.
107
108           "p" The symbol is in a stack unwind section.
109
110           "R"
111           "r" The symbol is in a read only data section.
112
113           "S"
114           "s" The symbol is in an uninitialized or zero-initialized data
115               section for small objects.
116
117           "T"
118           "t" The symbol is in the text (code) section.
119
120           "U" The symbol is undefined.
121
122           "u" The symbol is a unique global symbol.  This is a GNU extension
123               to the standard set of ELF symbol bindings.  For such a symbol
124               the dynamic linker will make sure that in the entire process
125               there is just one symbol with this name and type in use.
126
127           "V"
128           "v" The symbol is a weak object.  When a weak defined symbol is
129               linked with a normal defined symbol, the normal defined symbol
130               is used with no error.  When a weak undefined symbol is linked
131               and the symbol is not defined, the value of the weak symbol
132               becomes zero with no error.  On some systems, uppercase
133               indicates that a default value has been specified.
134
135           "W"
136           "w" The symbol is a weak symbol that has not been specifically
137               tagged as a weak object symbol.  When a weak defined symbol is
138               linked with a normal defined symbol, the normal defined symbol
139               is used with no error.  When a weak undefined symbol is linked
140               and the symbol is not defined, the value of the symbol is
141               determined in a system-specific manner without error.  On some
142               systems, uppercase indicates that a default value has been
143               specified.
144
145           "-" The symbol is a stabs symbol in an a.out object file.  In this
146               case, the next values printed are the stabs other field, the
147               stabs desc field, and the stab type.  Stabs symbols are used to
148               hold debugging information.
149
150           "?" The symbol type is unknown, or object file format specific.
151
152       •   The symbol name.  If a symbol has version information associated
153           with it, then the version information is displayed as well.  If the
154           versioned symbol is undefined or hidden from linker, the version
155           string is displayed as a suffix to the symbol name, preceded by an
156           @ character.  For example foo@VER_1.  If the version is the default
157           version to be used when resolving unversioned references to the
158           symbol, then it is displayed as a suffix preceded by two @
159           characters.  For example foo@@VER_2.
160

OPTIONS

162       The long and short forms of options, shown here as alternatives, are
163       equivalent.
164
165       -A
166       -o
167       --print-file-name
168           Precede each symbol by the name of the input file (or archive
169           member) in which it was found, rather than identifying the input
170           file once only, before all of its symbols.
171
172       -a
173       --debug-syms
174           Display all symbols, even debugger-only symbols; normally these are
175           not listed.
176
177       -B  The same as --format=bsd (for compatibility with the MIPS nm).
178
179       -C
180       --demangle[=style]
181           Decode (demangle) low-level symbol names into user-level names.
182           Besides removing any initial underscore prepended by the system,
183           this makes C++ function names readable. Different compilers have
184           different mangling styles. The optional demangling style argument
185           can be used to choose an appropriate demangling style for your
186           compiler.
187
188       --no-demangle
189           Do not demangle low-level symbol names.  This is the default.
190
191       --recurse-limit
192       --no-recurse-limit
193       --recursion-limit
194       --no-recursion-limit
195           Enables or disables a limit on the amount of recursion performed
196           whilst demangling strings.  Since the name mangling formats allow
197           for an infinite level of recursion it is possible to create strings
198           whose decoding will exhaust the amount of stack space available on
199           the host machine, triggering a memory fault.  The limit tries to
200           prevent this from happening by restricting recursion to 2048 levels
201           of nesting.
202
203           The default is for this limit to be enabled, but disabling it may
204           be necessary in order to demangle truly complicated names.  Note
205           however that if the recursion limit is disabled then stack
206           exhaustion is possible and any bug reports about such an event will
207           be rejected.
208
209       -D
210       --dynamic
211           Display the dynamic symbols rather than the normal symbols.  This
212           is only meaningful for dynamic objects, such as certain types of
213           shared libraries.
214
215       -f format
216       --format=format
217           Use the output format format, which can be "bsd", "sysv", "posix"
218           or "just-symbols".  The default is "bsd".  Only the first character
219           of format is significant; it can be either upper or lower case.
220
221       -g
222       --extern-only
223           Display only external symbols.
224
225       -h
226       --help
227           Show a summary of the options to nm and exit.
228
229       --ifunc-chars=CHARS
230           When display GNU indirect function symbols nm will default to using
231           the "i" character for both local indirect functions and global
232           indirect functions.  The --ifunc-chars option allows the user to
233           specify a string containing one or two characters. The first
234           character will be used for global indirect function symbols and the
235           second character, if present, will be used for local indirect
236           function symbols.
237
238       j   The same as --format=just-symbols.
239
240       -l
241       --line-numbers
242           For each symbol, use debugging information to try to find a
243           filename and line number.  For a defined symbol, look for the line
244           number of the address of the symbol.  For an undefined symbol, look
245           for the line number of a relocation entry which refers to the
246           symbol.  If line number information can be found, print it after
247           the other symbol information.
248
249       --inlines
250           When option -l is active, if the address belongs to a function that
251           was inlined, then this option causes the source information for all
252           enclosing scopes back to the first non-inlined function to be
253           printed as well.  For example, if "main" inlines "callee1" which
254           inlines "callee2", and address is from "callee2", the source
255           information for "callee1" and "main" will also be printed.
256
257       -n
258       -v
259       --numeric-sort
260           Sort symbols numerically by their addresses, rather than
261           alphabetically by their names.
262
263       -p
264       --no-sort
265           Do not bother to sort the symbols in any order; print them in the
266           order encountered.
267
268       -P
269       --portability
270           Use the POSIX.2 standard output format instead of the default
271           format.  Equivalent to -f posix.
272
273       -r
274       --reverse-sort
275           Reverse the order of the sort (whether numeric or alphabetic); let
276           the last come first.
277
278       -S
279       --print-size
280           Print both value and size of defined symbols for the "bsd" output
281           style.  This option has no effect for object formats that do not
282           record symbol sizes, unless --size-sort is also used in which case
283           a calculated size is displayed.
284
285       -s
286       --print-armap
287           When listing symbols from archive members, include the index: a
288           mapping (stored in the archive by ar or ranlib) of which modules
289           contain definitions for which names.
290
291       -t radix
292       --radix=radix
293           Use radix as the radix for printing the symbol values.  It must be
294           d for decimal, o for octal, or x for hexadecimal.
295
296       -u
297       --undefined-only
298           Display only undefined symbols (those external to each object
299           file).  By default both defined and undefined symbols are
300           displayed.
301
302       -U
303       --defined-only
304           Display only defined symbols for each object file.  By default both
305           defined and undefined symbols are displayed.
306
307       -V
308       --version
309           Show the version number of nm and exit.
310
311       -X  This option is ignored for compatibility with the AIX version of
312           nm.  It takes one parameter which must be the string 32_64.  The
313           default mode of AIX nm corresponds to -X 32, which is not supported
314           by GNU nm.
315
316       --plugin name
317           Load the plugin called name to add support for extra target types.
318           This option is only available if the toolchain has been built with
319           plugin support enabled.
320
321           If --plugin is not provided, but plugin support has been enabled
322           then nm iterates over the files in ${libdir}/bfd-plugins in
323           alphabetic order and the first plugin that claims the object in
324           question is used.
325
326           Please note that this plugin search directory is not the one used
327           by ld's -plugin option.  In order to make nm use the  linker plugin
328           it must be copied into the ${libdir}/bfd-plugins directory.  For
329           GCC based compilations the linker plugin is called
330           liblto_plugin.so.0.0.0.  For Clang based compilations it is called
331           LLVMgold.so.  The GCC plugin is always backwards compatible with
332           earlier versions, so it is sufficient to just copy the newest one.
333
334       --size-sort
335           Sort symbols by size.  For ELF objects symbol sizes are read from
336           the ELF, for other object types the symbol sizes are computed as
337           the difference between the value of the symbol and the value of the
338           symbol with the next higher value.  If the "bsd" output format is
339           used the size of the symbol is printed, rather than the value, and
340           -S must be used in order both size and value to be printed.
341
342           Note - this option does not work if --undefined-only has been
343           enabled as undefined symbols have no size.
344
345       --special-syms
346           Display symbols which have a target-specific special meaning.
347           These symbols are usually used by the target for some special
348           processing and are not normally helpful when included in the normal
349           symbol lists.  For example for ARM targets this option would skip
350           the mapping symbols used to mark transitions between ARM code,
351           THUMB code and data.
352
353       --synthetic
354           Include synthetic symbols in the output.  These are special symbols
355           created by the linker for various purposes.  They are not shown by
356           default since they are not part of the binary's original source
357           code.
358
359       --unicode=[default|invalid|locale|escape|hex|highlight]
360           Controls the display of UTF-8 encoded multibyte characters in
361           strings.  The default (--unicode=default) is to give them no
362           special treatment.  The --unicode=locale option displays the
363           sequence in the current locale, which may or may not support them.
364           The options --unicode=hex and --unicode=invalid display them as hex
365           byte sequences enclosed by either angle brackets or curly braces.
366
367           The --unicode=escape option displays them as escape sequences
368           (\uxxxx) and the --unicode=highlight option displays them as escape
369           sequences highlighted in red (if supported by the output device).
370           The colouring is intended to draw attention to the presence of
371           unicode sequences where they might not be expected.
372
373       -W
374       --no-weak
375           Do not display weak symbols.
376
377       --with-symbol-versions
378       --without-symbol-versions
379           Enables or disables the display of symbol version information.  The
380           version string is displayed as a suffix to the symbol name,
381           preceded by an @ character.  For example foo@VER_1.  If the version
382           is the default version to be used when resolving unversioned
383           references to the symbol then it is displayed as a suffix preceded
384           by two @ characters.  For example foo@@VER_2.  By default, symbol
385           version information is displayed.
386
387       --target=bfdname
388           Specify an object code format other than your system's default
389           format.
390
391       @file
392           Read command-line options from file.  The options read are inserted
393           in place of the original @file option.  If file does not exist, or
394           cannot be read, then the option will be treated literally, and not
395           removed.
396
397           Options in file are separated by whitespace.  A whitespace
398           character may be included in an option by surrounding the entire
399           option in either single or double quotes.  Any character (including
400           a backslash) may be included by prefixing the character to be
401           included with a backslash.  The file may itself contain additional
402           @file options; any such options will be processed recursively.
403

SEE ALSO

405       ar(1), objdump(1), ranlib(1), and the Info entries for binutils.
406
408       Copyright (c) 1991-2023 Free Software Foundation, Inc.
409
410       Permission is granted to copy, distribute and/or modify this document
411       under the terms of the GNU Free Documentation License, Version 1.3 or
412       any later version published by the Free Software Foundation; with no
413       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
414       Texts.  A copy of the license is included in the section entitled "GNU
415       Free Documentation License".
416
417
418
419binutils-2.41                     2023-08-16                             NM(1)
Impressum