aboutsummaryrefslogtreecommitdiff
path: root/binutils/ar.1
blob: e4e8cff8134ad27bf56f1e9986fca72c688309d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
.\" Copyright (c) 1991 Free Software Foundation
.\" See section COPYING for conditions for redistribution
.TH ar 1 "5 November 1991" "cygnus support" "GNU Development Tools"
.de BP
.sp
.ti \-.2i
\(**
..

.SH NAME
ar \- create, modify, and extract from archives.

.SH SYNOPSIS
.hy 0
.na
.BR ar " [\|" "-" "\|]"\c
.I {dmpqrtx}[abcilosSuvV] \c
[\|\c
.I membername\c
\&\|] \c
.I archive\c
\& \c
.I files\c
\&.\|.\|.

.ad b
.hy 1
.SH DESCRIPTION
The GNU \c
.B ar\c
\& program creates, modifies, and extracts from
archives.  An \c
.I archive\c
\& is a single file holding a collection of
other files in a structure that makes it possible to retrieve
the original individual files (called \c
.I members\c
\& of the archive).

The original files' contents, mode (permissions), timestamp, owner, and
group are preserved in the archive, and may be reconstituted on
extraction.  

GNU \c
.B ar\c
\& can maintain archives whose members have names of any
length; however, depending on how \c
.B ar\c
\& is configured on your
system, a limit on member-name length may be imposed (for compatibility
with archive formats maintained with other tools).  If it exists, the
limit is often 15 characters (typical of formats related to a.out) or 16
characters (typical of formats related to coff).

\c
.B ar\c
\& is considered a binary utility because archives of this sort
are most often used as \c
.I libraries\c
\& holding commonly needed
subroutines.

\c
.B ar\c
\& will create an index to the symbols defined in relocatable
object modules in the archive when you specify the modifier `\|\c
.B s\c
\|'.
Once created, this index is updated in the archive whenever \c
.B ar\c
\&
makes a change to its contents (save for the `\|\c
.B q\c
\|' update operation).
An archive with such an index speeds up linking to the library, and
allows routines in the library to call each other without regard to
their placement in the archive.

You may use `\|\c
.B nm \-s\c
\|' or `\|\c
.B nm \-\-print\-armap\c
\|' to list this index
table.  If an archive lacks the table, another form of \c
.B ar\c
\& called
\c
.B ranlib\c
\& can be used to add just the table.

\c
.B ar\c
\& insists on at least two arguments to execute: one
keyletter specifying the \c
.I operation\c
\& (optionally accompanied by other
keyletters specifying \c
.I modifiers\c
\&), and the archive name to act on.

Most operations can also accept further \c
.I files\c
\& arguments,
specifying particular files to operate on.

.SH OPTIONS
GNU \c
.B ar\c
\& allows you to mix the operation code \c
.I p\c
\& and modifier
flags \c
.I mod\c
\& in any order, within the first command-line argument.

If you wish, you may begin the first command-line argument with a
dash.

The \c
.I p\c
\& keyletter specifies what operation to execute; it may be
any of the following, but you must specify only one of them:

.TP
.B d
\c
.I Delete\c
\& modules from the archive.  Specify the names of modules to
be deleted as \c
.I files\c
\&; the archive is untouched if you
specify no files to delete.

If you specify the `\|\c
.B v\c
\|' modifier, \c
.B ar\c
\& will list each module
as it is deleted.

.TP
.B m
Use this operation to \c
.I move\c
\& members in an archive.

The ordering of members in an archive can make a difference in how
programs are linked using the library, if a symbol is defined in more
than one member.  

If no modifiers are used with \c
.B m\c
\&, any members you name in the
\c
.I files\c
\& arguments are moved to the \c
.I end\c
\& of the archive;
you can use the `\|\c
.B a\c
\|', `\|\c
.B b\c
\|', or `\|\c
.B i\c
\|' modifiers to move them to a
specified place instead.

.TP
.B p
\c
.I Print\c
\& the specified members of the archive, to the standard
output file.  If the `\|\c
.B v\c
\|' modifier is specified, show the member
name before copying its contents to standard output.

If you specify no \c
.I files\c
\&, all the files in the archive are printed.

.TP
.B q
\c
.I Quick append\c
\&; add \c
.I files\c
\& to the end of \c
.I archive\c
\&,
without checking for replacement.  

The modifiers `\|\c
.B a\c
\|', `\|\c
.B b\c
\|', and `\|\c
.B i\c
\|' do \c
.I not\c
\& affect this
operation; new members are always placed at the end of the archive.

The modifier `\|\c
.B v\c
\|' makes \c
.B ar\c
\& list each file as it is appended.

Since the point of this operation is speed, the archive's symbol table
index is not updated, even if it already existed; you can use `\|\c
.B ar s\c
\|' or
\c
.B ranlib\c
\& explicitly to update the symbol table index.

However, too many different systems assume quick append rebuilds the
index, so GNU
.B ar
implements `\|\c
.B q\c
\|' as a synonym for `\|\c
.B r\c
\|'.

.TP
.B r
Insert \c
.I files\c
\& into \c
.I archive\c
\& (with \c
.I replacement\c
\&). This
operation differs from `\|\c
.B q\c
\|' in that any previously existing members
are deleted if their names match those being added.

If one of the files named in \c
.I files\c
\& doesn't exist, \c
.B ar\c
\&
displays an error message, and leaves undisturbed any existing members
of the archive matching that name.

By default, new members are added at the end of the file; but you may
use one of the modifiers `\|\c
.B a\c
\|', `\|\c
.B b\c
\|', or `\|\c
.B i\c
\|' to request
placement relative to some existing member.

The modifier `\|\c
.B v\c
\|' used with this operation elicits a line of
output for each file inserted, along with one of the letters `\|\c
.B a\c
\|' or
`\|\c
.B r\c
\|' to indicate whether the file was appended (no old member
deleted) or replaced.

.TP
.B t
Display a \c
.I table\c
\& listing the contents of \c
.I archive\c
\&, or those
of the files listed in \c
.I files\c
\& that are present in the
archive.  Normally only the member name is shown; if you also want to
see the modes (permissions), timestamp, owner, group, and size, you can
request that by also specifying the `\|\c
.B v\c
\|' modifier.

If you do not specify any \c
.I files\c
\&, all files in the archive
are listed.

If there is more than one file with the same name (say, `\|\c
.B fie\c
\|') in
an archive (say `\|\c
.B b.a\c
\|'), `\|\c
.B ar t b.a fie\c
\|' will list only the
first instance; to see them all, you must ask for a complete
listing\(em\&in our example, `\|\c
.B ar t b.a\c
\|'.

.TP
.B x
\c
.I Extract\c
\& members (named \c
.I files\c
\&) from the archive.  You can
use the `\|\c
.B v\c
\|' modifier with this operation, to request that
\c
.B ar\c
\& list each name as it extracts it.

If you do not specify any \c
.I files\c
\&, all files in the archive
are extracted.

.PP

A number of modifiers (\c
.I mod\c
\&) may immediately follow the \c
.I p\c
\&
keyletter, to specify variations on an operation's behavior:

.TP
.B a
Add new files \c
.I after\c
\& an existing member of the
archive.  If you use the modifier \c
.B a\c
\&, the name of an existing archive
member must be present as the \c
.I membername\c
\& argument, before the
\c
.I archive\c
\& specification.

.TP
.B b
Add new files \c
.I before\c
\& an existing member of the
archive.  If you use the modifier \c
.B b\c
\&, the name of an existing archive
member must be present as the \c
.I membername\c
\& argument, before the
\c
.I archive\c
\& specification.  (same as `\|\c
.B i\c
\|').

.TP
.B c
\c
.I Create\c
\& the archive.  The specified \c
.I archive\c
\& is always
created if it didn't exist, when you request an update.  But a warning is
issued unless you specify in advance that you expect to create it, by
using this modifier.

.TP
.B f
Truncate names in the archive.  
.B ar
will normally permit file names of any length.  This will cause it to
create archives which are not compatible with the native 
.B ar
program on some systems.  If this is a concern, the 
.B f
modifier may be used to truncate file names when putting them in the
archive.

.TP
.B i
Insert new files \c
.I before\c
\& an existing member of the
archive.  If you use the modifier \c
.B i\c
\&, the name of an existing archive
member must be present as the \c
.I membername\c
\& argument, before the
\c
.I archive\c
\& specification.  (same as `\|\c
.B b\c
\|').

.TP
.B l
This modifier is accepted but not used.

.TP
.B o
Preserve the \c
.I original\c
\& dates of members when extracting them.  If
you do not specify this modifier, files extracted from the archive
will be stamped with the time of extraction.

.TP
.B s
Write an object-file index into the archive, or update an existing one,
even if no other change is made to the archive.  You may use this modifier
flag either with any operation, or alone.  Running `\|\c
.B ar s\c
\|' on an
archive is equivalent to running `\|\c
.B ranlib\c
\|' on it.

.TP
.B S
Do not generate an archive symbol table.  This can speed up building a
large library in several steps.  The resulting archive can not be used
with the linker.  In order to build a symbol table, you must omit the
`\|\c
.B S\c
\|' modifier on the last execution of `\|\c
.B ar\c
\|', or you must run `\|\c
.B ranlib\c
\|' on the archive.

.TP
.B u
Normally, \c
.B ar r\c
\&.\|.\|. inserts all files
listed into the archive.  If you would like to insert \c
.I only\c
\& those
of the files you list that are newer than existing members of the same
names, use this modifier.  The `\|\c
.B u\c
\|' modifier is allowed only for the
operation `\|\c
.B r\c
\|' (replace).  In particular, the combination `\|\c
.B qu\c
\|' is
not allowed, since checking the timestamps would lose any speed
advantage from the operation `\|\c
.B q\c
\|'.

.TP
.B v
This modifier requests the \c
.I verbose\c
\& version of an operation.  Many
operations display additional information, such as filenames processed,
when the modifier `\|\c
.B v\c
\|' is appended.

.TP
.B V
This modifier shows the version number of
.BR ar .

.PP

.SH "SEE ALSO"
.RB "`\|" binutils "\|'"
entry in 
.B
info\c
\&; 
.I
The GNU Binary Utilities\c
, Roland H. Pesch (October 1991).
.BR nm ( 1 )\c
\&,
.BR ranlib ( 1 )\c
\&.

.SH COPYING
Copyright (c) 1991 Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
.PP
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
.PP
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.