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