• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/binutils.html/
1<html lang="en">
2<head>
3<title>nm - GNU Binary Utilities</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="GNU Binary Utilities">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="prev" href="ar.html#ar" title="ar">
9<link rel="next" href="objcopy.html#objcopy" title="objcopy">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1991-2013 Free Software Foundation, Inc.
13
14Permission is granted to copy, distribute and/or modify this document
15under the terms of the GNU Free Documentation License, Version 1.3
16or any later version published by the Free Software Foundation;
17with no Invariant Sections, with no Front-Cover Texts, and with no
18Back-Cover Texts.  A copy of the license is included in the
19section entitled ``GNU Free Documentation License''.
20
21-->
22<meta http-equiv="Content-Style-Type" content="text/css">
23<style type="text/css"><!--
24  pre.display { font-family:inherit }
25  pre.format  { font-family:inherit }
26  pre.smalldisplay { font-family:inherit; font-size:smaller }
27  pre.smallformat  { font-family:inherit; font-size:smaller }
28  pre.smallexample { font-size:smaller }
29  pre.smalllisp    { font-size:smaller }
30  span.sc    { font-variant:small-caps }
31  span.roman { font-family:serif; font-weight:normal; } 
32  span.sansserif { font-family:sans-serif; font-weight:normal; } 
33--></style>
34<link rel="stylesheet" type="text/css" href="../cs.css">
35</head>
36<body>
37<div class="node">
38<a name="nm"></a>
39<p>
40Next:&nbsp;<a rel="next" accesskey="n" href="objcopy.html#objcopy">objcopy</a>,
41Previous:&nbsp;<a rel="previous" accesskey="p" href="ar.html#ar">ar</a>,
42Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
43<hr>
44</div>
45
46<h2 class="chapter">2 nm</h2>
47
48<p><a name="index-symbols-36"></a><a name="index-nm-37"></a>
49<!-- man title nm list symbols from object files -->
50
51<pre class="smallexample">     <!-- man begin SYNOPSIS nm -->
52     nm [<samp><span class="option">-A</span></samp>|<samp><span class="option">-o</span></samp>|<samp><span class="option">--print-file-name</span></samp>] [<samp><span class="option">-a</span></samp>|<samp><span class="option">--debug-syms</span></samp>]
53        [<samp><span class="option">-B</span></samp>|<samp><span class="option">--format=bsd</span></samp>] [<samp><span class="option">-C</span></samp>|<samp><span class="option">--demangle</span></samp>[=<var>style</var>]]
54        [<samp><span class="option">-D</span></samp>|<samp><span class="option">--dynamic</span></samp>] [<samp><span class="option">-f</span></samp><var>format</var>|<samp><span class="option">--format=</span></samp><var>format</var>]
55        [<samp><span class="option">-g</span></samp>|<samp><span class="option">--extern-only</span></samp>] [<samp><span class="option">-h</span></samp>|<samp><span class="option">--help</span></samp>]
56        [<samp><span class="option">-l</span></samp>|<samp><span class="option">--line-numbers</span></samp>] [<samp><span class="option">-n</span></samp>|<samp><span class="option">-v</span></samp>|<samp><span class="option">--numeric-sort</span></samp>]
57        [<samp><span class="option">-P</span></samp>|<samp><span class="option">--portability</span></samp>] [<samp><span class="option">-p</span></samp>|<samp><span class="option">--no-sort</span></samp>]
58        [<samp><span class="option">-r</span></samp>|<samp><span class="option">--reverse-sort</span></samp>] [<samp><span class="option">-S</span></samp>|<samp><span class="option">--print-size</span></samp>]
59        [<samp><span class="option">-s</span></samp>|<samp><span class="option">--print-armap</span></samp>] [<samp><span class="option">-t</span></samp> <var>radix</var>|<samp><span class="option">--radix=</span></samp><var>radix</var>]
60        [<samp><span class="option">-u</span></samp>|<samp><span class="option">--undefined-only</span></samp>] [<samp><span class="option">-V</span></samp>|<samp><span class="option">--version</span></samp>]
61        [<samp><span class="option">-X 32_64</span></samp>] [<samp><span class="option">--defined-only</span></samp>] [<samp><span class="option">--no-demangle</span></samp>]
62        [<samp><span class="option">--plugin</span></samp> <var>name</var>] [<samp><span class="option">--size-sort</span></samp>] [<samp><span class="option">--special-syms</span></samp>]
63        [<samp><span class="option">--synthetic</span></samp>] [<samp><span class="option">--target=</span></samp><var>bfdname</var>]
64        [<var>objfile</var>...]
65     <!-- man end -->
66</pre>
67   <!-- man begin DESCRIPTION nm -->
68   <p><span class="sc">gnu</span> <samp><span class="command">nm</span></samp> lists the symbols from object files <var>objfile</var><small class="dots">...</small>. 
69If no object files are listed as arguments, <samp><span class="command">nm</span></samp> assumes the file
70<samp><span class="file">a.out</span></samp>.
71
72   <p>For each symbol, <samp><span class="command">nm</span></samp> shows:
73
74     <ul>
75<li>The symbol value, in the radix selected by options (see below), or
76hexadecimal by default.
77
78     <li>The symbol type.  At least the following types are used; others are, as
79well, depending on the object file format.  If lowercase, the symbol is
80usually local; if uppercase, the symbol is global (external).  There
81are however a few lowercase symbols that are shown for special global
82symbols (<code>u</code>, <code>v</code> and <code>w</code>).
83
84     <!-- Some more detail on exactly what these symbol types are used for -->
85     <!-- would be nice. -->
86          <dl>
87<dt><code>A</code><dd>The symbol's value is absolute, and will not be changed by further
88linking.
89
90          <br><dt><code>B</code><dt><code>b</code><dd>The symbol is in the uninitialized data section (known as BSS).
91
92          <br><dt><code>C</code><dd>The symbol is common.  Common symbols are uninitialized data.  When
93linking, multiple common symbols may appear with the same name.  If the
94symbol is defined anywhere, the common symbols are treated as undefined
95references. 
96For more details on common symbols, see the discussion of
97&ndash;warn-common in <a href="../ld/Options.html#Options">Linker options</a>.
98
99          <br><dt><code>D</code><dt><code>d</code><dd>The symbol is in the initialized data section.
100
101          <br><dt><code>G</code><dt><code>g</code><dd>The symbol is in an initialized data section for small objects.  Some
102object file formats permit more efficient access to small data objects,
103such as a global int variable as opposed to a large global array.
104
105          <br><dt><code>i</code><dd>For PE format files this indicates that the symbol is in a section
106specific to the implementation of DLLs.  For ELF format files this
107indicates that the symbol is an indirect function.  This is a GNU
108extension to the standard set of ELF symbol types.  It indicates a
109symbol which if referenced by a relocation does not evaluate to its
110address, but instead must be invoked at runtime.  The runtime
111execution will then return the value to be used in the relocation.
112
113          <br><dt><code>I</code><dd>The symbol is an indirect reference to another symbol.
114
115          <br><dt><code>N</code><dd>The symbol is a debugging symbol.
116
117          <br><dt><code>p</code><dd>The symbols is in a stack unwind section.
118
119          <br><dt><code>R</code><dt><code>r</code><dd>The symbol is in a read only data section.
120
121          <br><dt><code>S</code><dt><code>s</code><dd>The symbol is in an uninitialized data section for small objects.
122
123          <br><dt><code>T</code><dt><code>t</code><dd>The symbol is in the text (code) section.
124
125          <br><dt><code>U</code><dd>The symbol is undefined.
126
127          <br><dt><code>u</code><dd>The symbol is a unique global symbol.  This is a GNU extension to the
128standard set of ELF symbol bindings.  For such a symbol the dynamic linker
129will make sure that in the entire process there is just one symbol with
130this name and type in use.
131
132          <br><dt><code>V</code><dt><code>v</code><dd>The symbol is a weak object.  When a weak defined symbol is linked with
133a normal defined symbol, the normal defined symbol is used with no error. 
134When a weak undefined symbol is linked and the symbol is not defined,
135the value of the weak symbol becomes zero with no error.  On some
136systems, uppercase indicates that a default value has been specified.
137
138          <br><dt><code>W</code><dt><code>w</code><dd>The symbol is a weak symbol that has not been specifically tagged as a
139weak object symbol.  When a weak defined symbol is linked with a normal
140defined symbol, the normal defined symbol is used with no error. 
141When a weak undefined symbol is linked and the symbol is not defined,
142the value of the symbol is determined in a system-specific manner without
143error.  On some systems, uppercase indicates that a default value has been
144specified.
145
146          <br><dt><code>-</code><dd>The symbol is a stabs symbol in an a.out object file.  In this case, the
147next values printed are the stabs other field, the stabs desc field, and
148the stab type.  Stabs symbols are used to hold debugging information.
149
150          <br><dt><code>?</code><dd>The symbol type is unknown, or object file format specific. 
151</dl>
152
153     <li>The symbol name. 
154</ul>
155
156<!-- man end -->
157<!-- man begin OPTIONS nm -->
158   <p>The long and short forms of options, shown here as alternatives, are
159equivalent.
160
161     <dl>
162<dt><samp><span class="env">-A</span></samp><dt><samp><span class="env">-o</span></samp><dt><samp><span class="env">--print-file-name</span></samp><dd><a name="index-input-file-name-38"></a><a name="index-file-name-39"></a><a name="index-source-file-name-40"></a>Precede each symbol by the name of the input file (or archive member)
163in which it was found, rather than identifying the input file once only,
164before all of its symbols.
165
166     <br><dt><samp><span class="env">-a</span></samp><dt><samp><span class="env">--debug-syms</span></samp><dd><a name="index-debugging-symbols-41"></a>Display all symbols, even debugger-only symbols; normally these are not
167listed.
168
169     <br><dt><samp><span class="env">-B</span></samp><dd><a name="index-g_t_0040command_007bnm_007d-format-42"></a><a name="index-g_t_0040command_007bnm_007d-compatibility-43"></a>The same as <samp><span class="option">--format=bsd</span></samp> (for compatibility with the MIPS <samp><span class="command">nm</span></samp>).
170
171     <br><dt><samp><span class="env">-C</span></samp><dt><samp><span class="env">--demangle[=</span><var>style</var><span class="env">]</span></samp><dd><a name="index-demangling-in-nm-44"></a>Decode (<dfn>demangle</dfn>) low-level symbol names into user-level names. 
172Besides removing any initial underscore prepended by the system, this
173makes C++ function names readable. Different compilers have different
174mangling styles. The optional demangling style argument can be used to
175choose an appropriate demangling style for your compiler. See <a href="c_002b_002bfilt.html#c_002b_002bfilt">c++filt</a>,
176for more information on demangling.
177
178     <br><dt><samp><span class="env">--no-demangle</span></samp><dd>Do not demangle low-level symbol names.  This is the default.
179
180     <br><dt><samp><span class="env">-D</span></samp><dt><samp><span class="env">--dynamic</span></samp><dd><a name="index-dynamic-symbols-45"></a>Display the dynamic symbols rather than the normal symbols.  This is
181only meaningful for dynamic objects, such as certain types of shared
182libraries.
183
184     <br><dt><samp><span class="env">-f </span><var>format</var></samp><dt><samp><span class="env">--format=</span><var>format</var></samp><dd><a name="index-g_t_0040command_007bnm_007d-format-46"></a><a name="index-g_t_0040command_007bnm_007d-compatibility-47"></a>Use the output format <var>format</var>, which can be <code>bsd</code>,
185<code>sysv</code>, or <code>posix</code>.  The default is <code>bsd</code>. 
186Only the first character of <var>format</var> is significant; it can be
187either upper or lower case.
188
189     <br><dt><samp><span class="env">-g</span></samp><dt><samp><span class="env">--extern-only</span></samp><dd><a name="index-external-symbols-48"></a>Display only external symbols.
190
191     <br><dt><samp><span class="env">-h</span></samp><dt><samp><span class="env">--help</span></samp><dd>Show a summary of the options to <samp><span class="command">nm</span></samp> and exit.
192
193     <br><dt><samp><span class="env">-l</span></samp><dt><samp><span class="env">--line-numbers</span></samp><dd><a name="index-symbol-line-numbers-49"></a>For each symbol, use debugging information to try to find a filename and
194line number.  For a defined symbol, look for the line number of the
195address of the symbol.  For an undefined symbol, look for the line
196number of a relocation entry which refers to the symbol.  If line number
197information can be found, print it after the other symbol information.
198
199     <br><dt><samp><span class="env">-n</span></samp><dt><samp><span class="env">-v</span></samp><dt><samp><span class="env">--numeric-sort</span></samp><dd>Sort symbols numerically by their addresses, rather than alphabetically
200by their names.
201
202     <br><dt><samp><span class="env">-p</span></samp><dt><samp><span class="env">--no-sort</span></samp><dd><a name="index-sorting-symbols-50"></a>Do not bother to sort the symbols in any order; print them in the order
203encountered.
204
205     <br><dt><samp><span class="env">-P</span></samp><dt><samp><span class="env">--portability</span></samp><dd>Use the POSIX.2 standard output format instead of the default format. 
206Equivalent to &lsquo;<samp><span class="samp">-f posix</span></samp>&rsquo;.
207
208     <br><dt><samp><span class="env">-r</span></samp><dt><samp><span class="env">--reverse-sort</span></samp><dd>Reverse the order of the sort (whether numeric or alphabetic); let the
209last come first.
210
211     <br><dt><samp><span class="env">-S</span></samp><dt><samp><span class="env">--print-size</span></samp><dd>Print both value and size of defined symbols for the <code>bsd</code> output style. 
212This option has no effect for object formats that do not record symbol
213sizes, unless &lsquo;<samp><span class="samp">--size-sort</span></samp>&rsquo; is also used in which case a
214calculated size is displayed.
215
216     <br><dt><samp><span class="env">-s</span></samp><dt><samp><span class="env">--print-armap</span></samp><dd><a name="index-symbol-index_002c-listing-51"></a>When listing symbols from archive members, include the index: a mapping
217(stored in the archive by <samp><span class="command">ar</span></samp> or <samp><span class="command">ranlib</span></samp>) of which modules
218contain definitions for which names.
219
220     <br><dt><samp><span class="env">-t </span><var>radix</var></samp><dt><samp><span class="env">--radix=</span><var>radix</var></samp><dd>Use <var>radix</var> as the radix for printing the symbol values.  It must be
221&lsquo;<samp><span class="samp">d</span></samp>&rsquo; for decimal, &lsquo;<samp><span class="samp">o</span></samp>&rsquo; for octal, or &lsquo;<samp><span class="samp">x</span></samp>&rsquo; for hexadecimal.
222
223     <br><dt><samp><span class="env">-u</span></samp><dt><samp><span class="env">--undefined-only</span></samp><dd><a name="index-external-symbols-52"></a><a name="index-undefined-symbols-53"></a>Display only undefined symbols (those external to each object file).
224
225     <br><dt><samp><span class="env">-V</span></samp><dt><samp><span class="env">--version</span></samp><dd>Show the version number of <samp><span class="command">nm</span></samp> and exit.
226
227     <br><dt><samp><span class="env">-X</span></samp><dd>This option is ignored for compatibility with the AIX version of
228<samp><span class="command">nm</span></samp>.  It takes one parameter which must be the string
229<samp><span class="option">32_64</span></samp>.  The default mode of AIX <samp><span class="command">nm</span></samp> corresponds
230to <samp><span class="option">-X 32</span></samp>, which is not supported by <span class="sc">gnu</span> <samp><span class="command">nm</span></samp>.
231
232     <br><dt><samp><span class="env">--defined-only</span></samp><dd><a name="index-external-symbols-54"></a><a name="index-undefined-symbols-55"></a>Display only defined symbols for each object file.
233
234     <br><dt><samp><span class="env">--plugin </span><var>name</var></samp><dd><a name="index-load-plugin-56"></a>Load the plugin called <var>name</var> to add support for extra target
235types.  This option is only available if the toolchain has been built
236with plugin support enabled.
237
238     <br><dt><samp><span class="env">--size-sort</span></samp><dd>Sort symbols by size.  The size is computed as the difference between
239the value of the symbol and the value of the symbol with the next higher
240value.  If the <code>bsd</code> output format is used the size of the symbol
241is printed, rather than the value, and &lsquo;<samp><span class="samp">-S</span></samp>&rsquo; must be used in order
242both size and value to be printed.
243
244     <br><dt><samp><span class="env">--special-syms</span></samp><dd>Display symbols which have a target-specific special meaning.  These
245symbols are usually used by the target for some special processing and
246are not normally helpful when included in the normal symbol lists. 
247For example for ARM targets this option would skip the mapping symbols
248used to mark transitions between ARM code, THUMB code and data.
249
250     <br><dt><samp><span class="env">--synthetic</span></samp><dd>Include synthetic symbols in the output.  These are special symbols
251created by the linker for various purposes.  They are not shown by
252default since they are not part of the binary's original source code.
253
254     <br><dt><samp><span class="env">--target=</span><var>bfdname</var></samp><dd><a name="index-object-code-format-57"></a>Specify an object code format other than your system's default format. 
255See <a href="Target-Selection.html#Target-Selection">Target Selection</a>, for more information.
256
257   </dl>
258
259<!-- man end -->
260   </body></html>
261
262