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