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