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