• 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-2011.09/share/doc/arm-arm-none-eabi/html/binutils.html/
1<html lang="en">
2<head>
3<title>ar cmdline - 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="up" href="ar.html#ar" title="ar">
9<link rel="next" href="ar-scripts.html#ar-scripts" title="ar scripts">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
132000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
14Free Software Foundation, Inc.
15
16Permission is granted to copy, distribute and/or modify this document
17under the terms of the GNU Free Documentation License, Version 1.3
18or any later version published by the Free Software Foundation;
19with no Invariant Sections, with no Front-Cover Texts, and with no
20Back-Cover Texts.  A copy of the license is included in the
21section entitled ``GNU Free Documentation License''.
22
23-->
24<meta http-equiv="Content-Style-Type" content="text/css">
25<style type="text/css"><!--
26  pre.display { font-family:inherit }
27  pre.format  { font-family:inherit }
28  pre.smalldisplay { font-family:inherit; font-size:smaller }
29  pre.smallformat  { font-family:inherit; font-size:smaller }
30  pre.smallexample { font-size:smaller }
31  pre.smalllisp    { font-size:smaller }
32  span.sc    { font-variant:small-caps }
33  span.roman { font-family:serif; font-weight:normal; } 
34  span.sansserif { font-family:sans-serif; font-weight:normal; } 
35--></style>
36<link rel="stylesheet" type="text/css" href="../cs.css">
37</head>
38<body>
39<div class="node">
40<a name="ar-cmdline"></a>
41<p>
42Next:&nbsp;<a rel="next" accesskey="n" href="ar-scripts.html#ar-scripts">ar scripts</a>,
43Up:&nbsp;<a rel="up" accesskey="u" href="ar.html#ar">ar</a>
44<hr>
45</div>
46
47<h3 class="section">1.1 Controlling <samp><span class="command">ar</span></samp> on the Command Line</h3>
48
49<pre class="smallexample">     <!-- man begin SYNOPSIS ar -->
50     ar [<samp><span class="option">--plugin</span></samp> <var>name</var>] [<samp><span class="option">-X32_64</span></samp>] [<samp><span class="option">-</span></samp>]<var>p</var>[<var>mod</var> [<var>relpos</var>] [<var>count</var>]] [<samp><span class="option">--target</span></samp> <var>bfdname</var>] <var>archive</var> [<var>member</var>...]
51     <!-- man end -->
52</pre>
53   <p><a name="index-Unix-compatibility_002c-_0040command_007bar_007d-11"></a>When you use <samp><span class="command">ar</span></samp> in the Unix style, <samp><span class="command">ar</span></samp> insists on at least two
54arguments to execute: one keyletter specifying the <em>operation</em>
55(optionally accompanied by other keyletters specifying
56<em>modifiers</em>), and the archive name to act on.
57
58   <p>Most operations can also accept further <var>member</var> arguments,
59specifying particular files to operate on.
60
61<!-- man begin OPTIONS ar -->
62   <p><span class="sc">gnu</span> <samp><span class="command">ar</span></samp> allows you to mix the operation code <var>p</var> and modifier
63flags <var>mod</var> in any order, within the first command-line argument.
64
65   <p>If you wish, you may begin the first command-line argument with a
66dash.
67
68   <p><a name="index-operations-on-archive-12"></a>The <var>p</var> keyletter specifies what operation to execute; it may be
69any of the following, but you must specify only one of them:
70
71     <dl>
72<dt>&lsquo;<samp><span class="samp">d</span></samp>&rsquo;<dd><a name="index-deleting-from-archive-13"></a><em>Delete</em> modules from the archive.  Specify the names of modules to
73be deleted as <var>member</var><small class="dots">...</small>; the archive is untouched if you
74specify no files to delete.
75
76     <p>If you specify the &lsquo;<samp><span class="samp">v</span></samp>&rsquo; modifier, <samp><span class="command">ar</span></samp> lists each module
77as it is deleted.
78
79     <br><dt>&lsquo;<samp><span class="samp">m</span></samp>&rsquo;<dd><a name="index-moving-in-archive-14"></a>Use this operation to <em>move</em> members in an archive.
80
81     <p>The ordering of members in an archive can make a difference in how
82programs are linked using the library, if a symbol is defined in more
83than one member.
84
85     <p>If no modifiers are used with <code>m</code>, any members you name in the
86<var>member</var> arguments are moved to the <em>end</em> of the archive;
87you can use the &lsquo;<samp><span class="samp">a</span></samp>&rsquo;, &lsquo;<samp><span class="samp">b</span></samp>&rsquo;, or &lsquo;<samp><span class="samp">i</span></samp>&rsquo; modifiers to move them to a
88specified place instead.
89
90     <br><dt>&lsquo;<samp><span class="samp">p</span></samp>&rsquo;<dd><a name="index-printing-from-archive-15"></a><em>Print</em> the specified members of the archive, to the standard
91output file.  If the &lsquo;<samp><span class="samp">v</span></samp>&rsquo; modifier is specified, show the member
92name before copying its contents to standard output.
93
94     <p>If you specify no <var>member</var> arguments, all the files in the archive are
95printed.
96
97     <br><dt>&lsquo;<samp><span class="samp">q</span></samp>&rsquo;<dd><a name="index-quick-append-to-archive-16"></a><em>Quick append</em>; Historically, add the files <var>member</var><small class="dots">...</small> to the end of
98<var>archive</var>, without checking for replacement.
99
100     <p>The modifiers &lsquo;<samp><span class="samp">a</span></samp>&rsquo;, &lsquo;<samp><span class="samp">b</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">i</span></samp>&rsquo; do <em>not</em> affect this
101operation; new members are always placed at the end of the archive.
102
103     <p>The modifier &lsquo;<samp><span class="samp">v</span></samp>&rsquo; makes <samp><span class="command">ar</span></samp> list each file as it is appended.
104
105     <p>Since the point of this operation is speed, the archive's symbol table
106index is not updated, even if it already existed; you can use &lsquo;<samp><span class="samp">ar s</span></samp>&rsquo; or
107<samp><span class="command">ranlib</span></samp> explicitly to update the symbol table index.
108
109     <p>However, too many different systems assume quick append rebuilds the
110index, so <span class="sc">gnu</span> <samp><span class="command">ar</span></samp> implements &lsquo;<samp><span class="samp">q</span></samp>&rsquo; as a synonym for &lsquo;<samp><span class="samp">r</span></samp>&rsquo;.
111
112     <br><dt>&lsquo;<samp><span class="samp">r</span></samp>&rsquo;<dd><a name="index-replacement-in-archive-17"></a>Insert the files <var>member</var><small class="dots">...</small> into <var>archive</var> (with
113<em>replacement</em>). This operation differs from &lsquo;<samp><span class="samp">q</span></samp>&rsquo; in that any
114previously existing members are deleted if their names match those being
115added.
116
117     <p>If one of the files named in <var>member</var><small class="dots">...</small> does not exist, <samp><span class="command">ar</span></samp>
118displays an error message, and leaves undisturbed any existing members
119of the archive matching that name.
120
121     <p>By default, new members are added at the end of the file; but you may
122use one of the modifiers &lsquo;<samp><span class="samp">a</span></samp>&rsquo;, &lsquo;<samp><span class="samp">b</span></samp>&rsquo;, or &lsquo;<samp><span class="samp">i</span></samp>&rsquo; to request
123placement relative to some existing member.
124
125     <p>The modifier &lsquo;<samp><span class="samp">v</span></samp>&rsquo; used with this operation elicits a line of
126output for each file inserted, along with one of the letters &lsquo;<samp><span class="samp">a</span></samp>&rsquo; or
127&lsquo;<samp><span class="samp">r</span></samp>&rsquo; to indicate whether the file was appended (no old member
128deleted) or replaced.
129
130     <br><dt>&lsquo;<samp><span class="samp">s</span></samp>&rsquo;<dd><a name="index-ranlib-18"></a>Add an index to the archive, or update it if it already exists.  Note
131this command is an exception to the rule that there can only be one
132command letter, as it is possible to use it as either a command or a
133modifier.  In either case it does the same thing.
134
135     <br><dt>&lsquo;<samp><span class="samp">t</span></samp>&rsquo;<dd><a name="index-contents-of-archive-19"></a>Display a <em>table</em> listing the contents of <var>archive</var>, or those
136of the files listed in <var>member</var><small class="dots">...</small> that are present in the
137archive.  Normally only the member name is shown; if you also want to
138see the modes (permissions), timestamp, owner, group, and size, you can
139request that by also specifying the &lsquo;<samp><span class="samp">v</span></samp>&rsquo; modifier.
140
141     <p>If you do not specify a <var>member</var>, all files in the archive
142are listed.
143
144     <p><a name="index-repeated-names-in-archive-20"></a><a name="index-name-duplication-in-archive-21"></a>If there is more than one file with the same name (say, &lsquo;<samp><span class="samp">fie</span></samp>&rsquo;) in
145an archive (say &lsquo;<samp><span class="samp">b.a</span></samp>&rsquo;), &lsquo;<samp><span class="samp">ar t b.a fie</span></samp>&rsquo; lists only the
146first instance; to see them all, you must ask for a complete
147listing&mdash;in our example, &lsquo;<samp><span class="samp">ar t b.a</span></samp>&rsquo;. 
148<!-- WRS only; per Gumby, this is implementation-dependent, and in a more -->
149<!-- recent case in fact works the other way. -->
150
151     <br><dt>&lsquo;<samp><span class="samp">x</span></samp>&rsquo;<dd><a name="index-extract-from-archive-22"></a><em>Extract</em> members (named <var>member</var>) from the archive.  You can
152use the &lsquo;<samp><span class="samp">v</span></samp>&rsquo; modifier with this operation, to request that
153<samp><span class="command">ar</span></samp> list each name as it extracts it.
154
155     <p>If you do not specify a <var>member</var>, all files in the archive
156are extracted.
157
158     <p>Files cannot be extracted from a thin archive.
159
160     <br><dt>&lsquo;<samp><span class="samp">--help</span></samp>&rsquo;<dd>Displays the list of command line options supported by <samp><span class="command">ar</span></samp>
161and then exits.
162
163     <br><dt>&lsquo;<samp><span class="samp">--version</span></samp>&rsquo;<dd>Displays the version information of <samp><span class="command">ar</span></samp> and then exits.
164
165   </dl>
166
167   <p>A number of modifiers (<var>mod</var>) may immediately follow the <var>p</var>
168keyletter, to specify variations on an operation's behavior:
169
170     <dl>
171<dt>&lsquo;<samp><span class="samp">a</span></samp>&rsquo;<dd><a name="index-relative-placement-in-archive-23"></a>Add new files <em>after</em> an existing member of the
172archive.  If you use the modifier &lsquo;<samp><span class="samp">a</span></samp>&rsquo;, the name of an existing archive
173member must be present as the <var>relpos</var> argument, before the
174<var>archive</var> specification.
175
176     <br><dt>&lsquo;<samp><span class="samp">b</span></samp>&rsquo;<dd>Add new files <em>before</em> an existing member of the
177archive.  If you use the modifier &lsquo;<samp><span class="samp">b</span></samp>&rsquo;, the name of an existing archive
178member must be present as the <var>relpos</var> argument, before the
179<var>archive</var> specification.  (same as &lsquo;<samp><span class="samp">i</span></samp>&rsquo;).
180
181     <br><dt>&lsquo;<samp><span class="samp">c</span></samp>&rsquo;<dd><a name="index-creating-archives-24"></a><em>Create</em> the archive.  The specified <var>archive</var> is always
182created if it did not exist, when you request an update.  But a warning is
183issued unless you specify in advance that you expect to create it, by
184using this modifier.
185
186     <br><dt>&lsquo;<samp><span class="samp">D</span></samp>&rsquo;<dd><a name="index-deterministic-archives-25"></a>Operate in <em>deterministic</em> mode.  When adding files and the archive
187index use zero for UIDs, GIDs, timestamps, and use consistent file modes
188for all files.  When this option is used, if <samp><span class="command">ar</span></samp> is used with
189identical options and identical input files, multiple runs will create
190identical output files regardless of the input files' owners, groups,
191file modes, or modification times.
192
193     <br><dt>&lsquo;<samp><span class="samp">f</span></samp>&rsquo;<dd>Truncate names in the archive.  <span class="sc">gnu</span> <samp><span class="command">ar</span></samp> will normally permit file
194names of any length.  This will cause it to create archives which are
195not compatible with the native <samp><span class="command">ar</span></samp> program on some systems.  If
196this is a concern, the &lsquo;<samp><span class="samp">f</span></samp>&rsquo; modifier may be used to truncate file
197names when putting them in the archive.
198
199     <br><dt>&lsquo;<samp><span class="samp">i</span></samp>&rsquo;<dd>Insert new files <em>before</em> an existing member of the
200archive.  If you use the modifier &lsquo;<samp><span class="samp">i</span></samp>&rsquo;, the name of an existing archive
201member must be present as the <var>relpos</var> argument, before the
202<var>archive</var> specification.  (same as &lsquo;<samp><span class="samp">b</span></samp>&rsquo;).
203
204     <br><dt>&lsquo;<samp><span class="samp">l</span></samp>&rsquo;<dd>This modifier is accepted but not used. 
205<!-- whaffor ar l modifier??? presumably compat; with -->
206<!-- what???-doc@@cygnus.com, 25jan91 -->
207
208     <br><dt>&lsquo;<samp><span class="samp">N</span></samp>&rsquo;<dd>Uses the <var>count</var> parameter.  This is used if there are multiple
209entries in the archive with the same name.  Extract or delete instance
210<var>count</var> of the given name from the archive.
211
212     <br><dt>&lsquo;<samp><span class="samp">o</span></samp>&rsquo;<dd><a name="index-dates-in-archive-26"></a>Preserve the <em>original</em> dates of members when extracting them.  If
213you do not specify this modifier, files extracted from the archive
214are stamped with the time of extraction.
215
216     <br><dt>&lsquo;<samp><span class="samp">P</span></samp>&rsquo;<dd>Use the full path name when matching names in the archive.  <span class="sc">gnu</span>
217<samp><span class="command">ar</span></samp> can not create an archive with a full path name (such archives
218are not POSIX complaint), but other archive creators can.  This option
219will cause <span class="sc">gnu</span> <samp><span class="command">ar</span></samp> to match file names using a complete path
220name, which can be convenient when extracting a single file from an
221archive created by another tool.
222
223     <br><dt>&lsquo;<samp><span class="samp">s</span></samp>&rsquo;<dd><a name="index-writing-archive-index-27"></a>Write an object-file index into the archive, or update an existing one,
224even if no other change is made to the archive.  You may use this modifier
225flag either with any operation, or alone.  Running &lsquo;<samp><span class="samp">ar s</span></samp>&rsquo; on an
226archive is equivalent to running &lsquo;<samp><span class="samp">ranlib</span></samp>&rsquo; on it.
227
228     <br><dt>&lsquo;<samp><span class="samp">S</span></samp>&rsquo;<dd><a name="index-not-writing-archive-index-28"></a>Do not generate an archive symbol table.  This can speed up building a
229large library in several steps.  The resulting archive can not be used
230with the linker.  In order to build a symbol table, you must omit the
231&lsquo;<samp><span class="samp">S</span></samp>&rsquo; modifier on the last execution of &lsquo;<samp><span class="samp">ar</span></samp>&rsquo;, or you must run
232&lsquo;<samp><span class="samp">ranlib</span></samp>&rsquo; on the archive.
233
234     <br><dt>&lsquo;<samp><span class="samp">T</span></samp>&rsquo;<dd><a name="index-creating-thin-archive-29"></a>Make the specified <var>archive</var> a <em>thin</em> archive.  If it already
235exists and is a regular archive, the existing members must be present
236in the same directory as <var>archive</var>.
237
238     <br><dt>&lsquo;<samp><span class="samp">u</span></samp>&rsquo;<dd><a name="index-updating-an-archive-30"></a>Normally, &lsquo;<samp><span class="samp">ar r</span></samp>&rsquo;<small class="dots">...</small> inserts all files
239listed into the archive.  If you would like to insert <em>only</em> those
240of the files you list that are newer than existing members of the same
241names, use this modifier.  The &lsquo;<samp><span class="samp">u</span></samp>&rsquo; modifier is allowed only for the
242operation &lsquo;<samp><span class="samp">r</span></samp>&rsquo; (replace).  In particular, the combination &lsquo;<samp><span class="samp">qu</span></samp>&rsquo; is
243not allowed, since checking the timestamps would lose any speed
244advantage from the operation &lsquo;<samp><span class="samp">q</span></samp>&rsquo;.
245
246     <br><dt>&lsquo;<samp><span class="samp">v</span></samp>&rsquo;<dd>This modifier requests the <em>verbose</em> version of an operation.  Many
247operations display additional information, such as filenames processed,
248when the modifier &lsquo;<samp><span class="samp">v</span></samp>&rsquo; is appended.
249
250     <br><dt>&lsquo;<samp><span class="samp">V</span></samp>&rsquo;<dd>This modifier shows the version number of <samp><span class="command">ar</span></samp>. 
251</dl>
252
253   <p><samp><span class="command">ar</span></samp> ignores an initial option spelt &lsquo;<samp><span class="samp">-X32_64</span></samp>&rsquo;, for
254compatibility with AIX.  The behaviour produced by this option is the
255default for <span class="sc">gnu</span> <samp><span class="command">ar</span></samp>.  <samp><span class="command">ar</span></samp> does not support any of the other
256&lsquo;<samp><span class="samp">-X</span></samp>&rsquo; options; in particular, it does not support <samp><span class="option">-X32</span></samp>
257which is the default for AIX <samp><span class="command">ar</span></samp>.
258
259   <p>The optional command line switch <samp><span class="option">--plugin</span></samp> <var>name</var> causes
260<samp><span class="command">ar</span></samp> to load the plugin called <var>name</var> which adds support
261for more file formats.  This option is only available if the toolchain
262has been built with plugin support enabled.
263
264   <p>The optional command line switch <samp><span class="option">--target</span></samp> <var>bfdname</var>
265specifies that the archive members are in an object code format
266different from your system's default format.  See
267See <a href="Target-Selection.html#Target-Selection">Target Selection</a>, for more information.
268
269<!-- man end -->
270   </body></html>
271
272