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 the read-only data section.
106
107           "p" The symbol is in a stack unwind section.
108
109           "R"
110           "r" The symbol is in a read only data section.
111
112           "S"
113           "s" The symbol is in an uninitialized or zero-initialized data
114               section for small objects.
115
116           "T"
117           "t" The symbol is in the text (code) section.
118
119           "U" The symbol is undefined.
120
121           "u" The symbol is a unique global symbol.  This is a GNU extension
122               to the standard set of ELF symbol bindings.  For such a symbol
123               the dynamic linker will make sure that in the entire process
124               there is just one symbol with this name and type in use.
125
126           "V"
127           "v" The symbol is a weak object.  When a weak defined symbol is
128               linked with a normal defined symbol, the normal defined symbol
129               is used with no error.  When a weak undefined symbol is linked
130               and the symbol is not defined, the value of the weak symbol
131               becomes zero with no error.  On some systems, uppercase
132               indicates that a default value has been specified.
133
134           "W"
135           "w" The symbol is a weak symbol that has not been specifically
136               tagged as a weak object symbol.  When a weak defined symbol is
137               linked with a normal defined symbol, the normal defined symbol
138               is used with no error.  When a weak undefined symbol is linked
139               and the symbol is not defined, the value of the symbol is
140               determined in a system-specific manner without error.  On some
141               systems, uppercase indicates that a default value has been
142               specified.
143
144           "-" The symbol is a stabs symbol in an a.out object file.  In this
145               case, the next values printed are the stabs other field, the
146               stabs desc field, and the stab type.  Stabs symbols are used to
147               hold debugging information.
148
149           "?" The symbol type is unknown, or object file format specific.
150
151       •   The symbol name.  If a symbol has version information associated
152           with it, then the version information is displayed as well.  If the
153           versioned symbol is undefined or hidden from linker, the version
154           string is displayed as a suffix to the symbol name, preceded by an
155           @ character.  For example foo@VER_1.  If the version is the default
156           version to be used when resolving unversioned references to the
157           symbol, then it is displayed as a suffix preceded by two @
158           characters.  For example foo@@VER_2.
159

OPTIONS

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

SEE ALSO

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