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