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