Merge branch 'vendor/LIBPCAP'
[dragonfly.git] / contrib / binutils-2.21 / binutils / doc / ar.1
1 .\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
29 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
30 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
31 .\" nothing in troff, for use with C<>.
32 .tr \(*W-
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" Escape single quotes in literal strings from groff's Unicode transform.
52 .ie \n(.g .ds Aq \(aq
53 .el       .ds Aq '
54 .\"
55 .\" If the F register is turned on, we'll generate index entries on stderr for
56 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
57 .\" entries marked with X<> in POD.  Of course, you'll have to process the
58 .\" output yourself in some meaningful fashion.
59 .ie \nF \{\
60 .    de IX
61 .    tm Index:\\$1\t\\n%\t"\\$2"
62 ..
63 .    nr % 0
64 .    rr F
65 .\}
66 .el \{\
67 .    de IX
68 ..
69 .\}
70 .\"
71 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
72 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
73 .    \" fudge factors for nroff and troff
74 .if n \{\
75 .    ds #H 0
76 .    ds #V .8m
77 .    ds #F .3m
78 .    ds #[ \f1
79 .    ds #] \fP
80 .\}
81 .if t \{\
82 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
83 .    ds #V .6m
84 .    ds #F 0
85 .    ds #[ \&
86 .    ds #] \&
87 .\}
88 .    \" simple accents for nroff and troff
89 .if n \{\
90 .    ds ' \&
91 .    ds ` \&
92 .    ds ^ \&
93 .    ds , \&
94 .    ds ~ ~
95 .    ds /
96 .\}
97 .if t \{\
98 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
99 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
100 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
101 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
102 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
103 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
104 .\}
105 .    \" troff and (daisy-wheel) nroff accents
106 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
107 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
108 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
109 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
110 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
111 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
112 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
113 .ds ae a\h'-(\w'a'u*4/10)'e
114 .ds Ae A\h'-(\w'A'u*4/10)'E
115 .    \" corrections for vroff
116 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
117 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
118 .    \" for low resolution devices (crt and lpr)
119 .if \n(.H>23 .if \n(.V>19 \
120 \{\
121 .    ds : e
122 .    ds 8 ss
123 .    ds o a
124 .    ds d- d\h'-1'\(ga
125 .    ds D- D\h'-1'\(hy
126 .    ds th \o'bp'
127 .    ds Th \o'LP'
128 .    ds ae ae
129 .    ds Ae AE
130 .\}
131 .rm #[ #] #H #V #F C
132 .\" ========================================================================
133 .\"
134 .IX Title "AR 1"
135 .TH AR 1 "2011-06-27" "binutils-2.21.1" "GNU Development Tools"
136 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
137 .\" way too many mistakes in technical documents.
138 .if n .ad l
139 .nh
140 .SH "NAME"
141 ar \- create, modify, and extract from archives
142 .SH "SYNOPSIS"
143 .IX Header "SYNOPSIS"
144 ar [\fB\-\-plugin\fR \fIname\fR] [\fB\-X32_64\fR] [\fB\-\fR]\fIp\fR[\fImod\fR [\fIrelpos\fR] [\fIcount\fR]] \fIarchive\fR [\fImember\fR...]
145 .SH "DESCRIPTION"
146 .IX Header "DESCRIPTION"
147 The \s-1GNU\s0 \fBar\fR program creates, modifies, and extracts from
148 archives.  An \fIarchive\fR is a single file holding a collection of
149 other files in a structure that makes it possible to retrieve
150 the original individual files (called \fImembers\fR of the archive).
151 .PP
152 The original files' contents, mode (permissions), timestamp, owner, and
153 group are preserved in the archive, and can be restored on
154 extraction.
155 .PP
156 \&\s-1GNU\s0 \fBar\fR can maintain archives whose members have names of any
157 length; however, depending on how \fBar\fR is configured on your
158 system, a limit on member-name length may be imposed for compatibility
159 with archive formats maintained with other tools.  If it exists, the
160 limit is often 15 characters (typical of formats related to a.out) or 16
161 characters (typical of formats related to coff).
162 .PP
163 \&\fBar\fR is considered a binary utility because archives of this sort
164 are most often used as \fIlibraries\fR holding commonly needed
165 subroutines.
166 .PP
167 \&\fBar\fR creates an index to the symbols defined in relocatable
168 object modules in the archive when you specify the modifier \fBs\fR.
169 Once created, this index is updated in the archive whenever \fBar\fR
170 makes a change to its contents (save for the \fBq\fR update operation).
171 An archive with such an index speeds up linking to the library, and
172 allows routines in the library to call each other without regard to
173 their placement in the archive.
174 .PP
175 You may use \fBnm \-s\fR or \fBnm \-\-print\-armap\fR to list this index
176 table.  If an archive lacks the table, another form of \fBar\fR called
177 \&\fBranlib\fR can be used to add just the table.
178 .PP
179 \&\s-1GNU\s0 \fBar\fR can optionally create a \fIthin\fR archive,
180 which contains a symbol index and references to the original copies
181 of the member files of the archives.  Such an archive is useful
182 for building libraries for use within a local build, where the
183 relocatable objects are expected to remain available, and copying the
184 contents of each object would only waste time and space.  Thin archives
185 are also \fIflattened\fR, so that adding one or more archives to a
186 thin archive will add the elements of the nested archive individually.
187 The paths to the elements of the archive are stored relative to the
188 archive itself.
189 .PP
190 \&\s-1GNU\s0 \fBar\fR is designed to be compatible with two different
191 facilities.  You can control its activity using command-line options,
192 like the different varieties of \fBar\fR on Unix systems; or, if you
193 specify the single command-line option \fB\-M\fR, you can control it
194 with a script supplied via standard input, like the \s-1MRI\s0 \*(L"librarian\*(R"
195 program.
196 .SH "OPTIONS"
197 .IX Header "OPTIONS"
198 \&\s-1GNU\s0 \fBar\fR allows you to mix the operation code \fIp\fR and modifier
199 flags \fImod\fR in any order, within the first command-line argument.
200 .PP
201 If you wish, you may begin the first command-line argument with a
202 dash.
203 .PP
204 The \fIp\fR keyletter specifies what operation to execute; it may be
205 any of the following, but you must specify only one of them:
206 .IP "\fBd\fR" 4
207 .IX Item "d"
208 \&\fIDelete\fR modules from the archive.  Specify the names of modules to
209 be deleted as \fImember\fR...; the archive is untouched if you
210 specify no files to delete.
211 .Sp
212 If you specify the \fBv\fR modifier, \fBar\fR lists each module
213 as it is deleted.
214 .IP "\fBm\fR" 4
215 .IX Item "m"
216 Use this operation to \fImove\fR members in an archive.
217 .Sp
218 The ordering of members in an archive can make a difference in how
219 programs are linked using the library, if a symbol is defined in more
220 than one member.
221 .Sp
222 If no modifiers are used with \f(CW\*(C`m\*(C'\fR, any members you name in the
223 \&\fImember\fR arguments are moved to the \fIend\fR of the archive;
224 you can use the \fBa\fR, \fBb\fR, or \fBi\fR modifiers to move them to a
225 specified place instead.
226 .IP "\fBp\fR" 4
227 .IX Item "p"
228 \&\fIPrint\fR the specified members of the archive, to the standard
229 output file.  If the \fBv\fR modifier is specified, show the member
230 name before copying its contents to standard output.
231 .Sp
232 If you specify no \fImember\fR arguments, all the files in the archive are
233 printed.
234 .IP "\fBq\fR" 4
235 .IX Item "q"
236 \&\fIQuick append\fR; Historically, add the files \fImember\fR... to the end of
237 \&\fIarchive\fR, without checking for replacement.
238 .Sp
239 The modifiers \fBa\fR, \fBb\fR, and \fBi\fR do \fInot\fR affect this
240 operation; new members are always placed at the end of the archive.
241 .Sp
242 The modifier \fBv\fR makes \fBar\fR list each file as it is appended.
243 .Sp
244 Since the point of this operation is speed, the archive's symbol table
245 index is not updated, even if it already existed; you can use \fBar s\fR or
246 \&\fBranlib\fR explicitly to update the symbol table index.
247 .Sp
248 However, too many different systems assume quick append rebuilds the
249 index, so \s-1GNU\s0 \fBar\fR implements \fBq\fR as a synonym for \fBr\fR.
250 .IP "\fBr\fR" 4
251 .IX Item "r"
252 Insert the files \fImember\fR... into \fIarchive\fR (with
253 \&\fIreplacement\fR). This operation differs from \fBq\fR in that any
254 previously existing members are deleted if their names match those being
255 added.
256 .Sp
257 If one of the files named in \fImember\fR... does not exist, \fBar\fR
258 displays an error message, and leaves undisturbed any existing members
259 of the archive matching that name.
260 .Sp
261 By default, new members are added at the end of the file; but you may
262 use one of the modifiers \fBa\fR, \fBb\fR, or \fBi\fR to request
263 placement relative to some existing member.
264 .Sp
265 The modifier \fBv\fR used with this operation elicits a line of
266 output for each file inserted, along with one of the letters \fBa\fR or
267 \&\fBr\fR to indicate whether the file was appended (no old member
268 deleted) or replaced.
269 .IP "\fBs\fR" 4
270 .IX Item "s"
271 Add an index to the archive, or update it if it already exists.  Note
272 this command is an exception to the rule that there can only be one
273 command letter, as it is possible to use it as either a command or a
274 modifier.  In either case it does the same thing.
275 .IP "\fBt\fR" 4
276 .IX Item "t"
277 Display a \fItable\fR listing the contents of \fIarchive\fR, or those
278 of the files listed in \fImember\fR... that are present in the
279 archive.  Normally only the member name is shown; if you also want to
280 see the modes (permissions), timestamp, owner, group, and size, you can
281 request that by also specifying the \fBv\fR modifier.
282 .Sp
283 If you do not specify a \fImember\fR, all files in the archive
284 are listed.
285 .Sp
286 If there is more than one file with the same name (say, \fBfie\fR) in
287 an archive (say \fBb.a\fR), \fBar t b.a fie\fR lists only the
288 first instance; to see them all, you must ask for a complete
289 listing\-\-\-in our example, \fBar t b.a\fR.
290 .IP "\fBx\fR" 4
291 .IX Item "x"
292 \&\fIExtract\fR members (named \fImember\fR) from the archive.  You can
293 use the \fBv\fR modifier with this operation, to request that
294 \&\fBar\fR list each name as it extracts it.
295 .Sp
296 If you do not specify a \fImember\fR, all files in the archive
297 are extracted.
298 .Sp
299 Files cannot be extracted from a thin archive.
300 .PP
301 A number of modifiers (\fImod\fR) may immediately follow the \fIp\fR
302 keyletter, to specify variations on an operation's behavior:
303 .IP "\fBa\fR" 4
304 .IX Item "a"
305 Add new files \fIafter\fR an existing member of the
306 archive.  If you use the modifier \fBa\fR, the name of an existing archive
307 member must be present as the \fIrelpos\fR argument, before the
308 \&\fIarchive\fR specification.
309 .IP "\fBb\fR" 4
310 .IX Item "b"
311 Add new files \fIbefore\fR an existing member of the
312 archive.  If you use the modifier \fBb\fR, the name of an existing archive
313 member must be present as the \fIrelpos\fR argument, before the
314 \&\fIarchive\fR specification.  (same as \fBi\fR).
315 .IP "\fBc\fR" 4
316 .IX Item "c"
317 \&\fICreate\fR the archive.  The specified \fIarchive\fR is always
318 created if it did not exist, when you request an update.  But a warning is
319 issued unless you specify in advance that you expect to create it, by
320 using this modifier.
321 .IP "\fBD\fR" 4
322 .IX Item "D"
323 Operate in \fIdeterministic\fR mode.  When adding files and the archive
324 index use zero for UIDs, GIDs, timestamps, and use consistent file modes
325 for all files.  When this option is used, if \fBar\fR is used with
326 identical options and identical input files, multiple runs will create
327 identical output files regardless of the input files' owners, groups,
328 file modes, or modification times.
329 .IP "\fBf\fR" 4
330 .IX Item "f"
331 Truncate names in the archive.  \s-1GNU\s0 \fBar\fR will normally permit file
332 names of any length.  This will cause it to create archives which are
333 not compatible with the native \fBar\fR program on some systems.  If
334 this is a concern, the \fBf\fR modifier may be used to truncate file
335 names when putting them in the archive.
336 .IP "\fBi\fR" 4
337 .IX Item "i"
338 Insert new files \fIbefore\fR an existing member of the
339 archive.  If you use the modifier \fBi\fR, the name of an existing archive
340 member must be present as the \fIrelpos\fR argument, before the
341 \&\fIarchive\fR specification.  (same as \fBb\fR).
342 .IP "\fBl\fR" 4
343 .IX Item "l"
344 This modifier is accepted but not used.
345 .IP "\fBN\fR" 4
346 .IX Item "N"
347 Uses the \fIcount\fR parameter.  This is used if there are multiple
348 entries in the archive with the same name.  Extract or delete instance
349 \&\fIcount\fR of the given name from the archive.
350 .IP "\fBo\fR" 4
351 .IX Item "o"
352 Preserve the \fIoriginal\fR dates of members when extracting them.  If
353 you do not specify this modifier, files extracted from the archive
354 are stamped with the time of extraction.
355 .IP "\fBP\fR" 4
356 .IX Item "P"
357 Use the full path name when matching names in the archive.  \s-1GNU\s0
358 \&\fBar\fR can not create an archive with a full path name (such archives
359 are not \s-1POSIX\s0 complaint), but other archive creators can.  This option
360 will cause \s-1GNU\s0 \fBar\fR to match file names using a complete path
361 name, which can be convenient when extracting a single file from an
362 archive created by another tool.
363 .IP "\fBs\fR" 4
364 .IX Item "s"
365 Write an object-file index into the archive, or update an existing one,
366 even if no other change is made to the archive.  You may use this modifier
367 flag either with any operation, or alone.  Running \fBar s\fR on an
368 archive is equivalent to running \fBranlib\fR on it.
369 .IP "\fBS\fR" 4
370 .IX Item "S"
371 Do not generate an archive symbol table.  This can speed up building a
372 large library in several steps.  The resulting archive can not be used
373 with the linker.  In order to build a symbol table, you must omit the
374 \&\fBS\fR modifier on the last execution of \fBar\fR, or you must run
375 \&\fBranlib\fR on the archive.
376 .IP "\fBT\fR" 4
377 .IX Item "T"
378 Make the specified \fIarchive\fR a \fIthin\fR archive.  If it already
379 exists and is a regular archive, the existing members must be present
380 in the same directory as \fIarchive\fR.
381 .IP "\fBu\fR" 4
382 .IX Item "u"
383 Normally, \fBar r\fR... inserts all files
384 listed into the archive.  If you would like to insert \fIonly\fR those
385 of the files you list that are newer than existing members of the same
386 names, use this modifier.  The \fBu\fR modifier is allowed only for the
387 operation \fBr\fR (replace).  In particular, the combination \fBqu\fR is
388 not allowed, since checking the timestamps would lose any speed
389 advantage from the operation \fBq\fR.
390 .IP "\fBv\fR" 4
391 .IX Item "v"
392 This modifier requests the \fIverbose\fR version of an operation.  Many
393 operations display additional information, such as filenames processed,
394 when the modifier \fBv\fR is appended.
395 .IP "\fBV\fR" 4
396 .IX Item "V"
397 This modifier shows the version number of \fBar\fR.
398 .PP
399 \&\fBar\fR ignores an initial option spelt \fB\-X32_64\fR, for
400 compatibility with \s-1AIX\s0.  The behaviour produced by this option is the
401 default for \s-1GNU\s0 \fBar\fR.  \fBar\fR does not support any of the other
402 \&\fB\-X\fR options; in particular, it does not support \fB\-X32\fR
403 which is the default for \s-1AIX\s0 \fBar\fR.
404 .PP
405 The optional command line switch \fB\-\-plugin\fR \fIname\fR causes
406 \&\fBar\fR to load the plugin called \fIname\fR which adds support
407 for more file formats.  This option is only available if the toolchain
408 has been built with plugin support enabled.
409 .IP "\fB@\fR\fIfile\fR" 4
410 .IX Item "@file"
411 Read command-line options from \fIfile\fR.  The options read are
412 inserted in place of the original @\fIfile\fR option.  If \fIfile\fR
413 does not exist, or cannot be read, then the option will be treated
414 literally, and not removed.
415 .Sp
416 Options in \fIfile\fR are separated by whitespace.  A whitespace
417 character may be included in an option by surrounding the entire
418 option in either single or double quotes.  Any character (including a
419 backslash) may be included by prefixing the character to be included
420 with a backslash.  The \fIfile\fR may itself contain additional
421 @\fIfile\fR options; any such options will be processed recursively.
422 .SH "SEE ALSO"
423 .IX Header "SEE ALSO"
424 \&\fInm\fR\|(1), \fIranlib\fR\|(1), and the Info entries for \fIbinutils\fR.
425 .SH "COPYRIGHT"
426 .IX Header "COPYRIGHT"
427 Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
428 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
429 Free Software Foundation, Inc.
430 .PP
431 Permission is granted to copy, distribute and/or modify this document
432 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
433 or any later version published by the Free Software Foundation;
434 with no Invariant Sections, with no Front-Cover Texts, and with no
435 Back-Cover Texts.  A copy of the license is included in the
436 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".