1999-09-12 Donn Terry <donn@interix.com>
[deliverable/binutils-gdb.git] / binutils / ar.1
CommitLineData
fe84ea5d 1.\" Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation
252b5132 2.\" See section COPYING for conditions for redistribution
fe84ea5d 3.TH ar 1 "1999" "Cygnus Solutions" "GNU Development Tools"
252b5132
RH
4.de BP
5.sp
6.ti \-.2i
7\(**
8..
9
10.SH NAME
11ar \- create, modify, and extract from archives.
12
13.SH SYNOPSIS
14.hy 0
15.na
16.BR ar " [\|" "-" "\|]"\c
17.I {dmpqrtx}[abcilosSuvV] \c
18[\|\c
19.I membername\c
20\&\|] \c
21.I archive\c
22\& \c
23.I files\c
24\&.\|.\|.
25
26.ad b
27.hy 1
28.SH DESCRIPTION
29The GNU \c
30.B ar\c
31\& program creates, modifies, and extracts from
32archives. An \c
33.I archive\c
34\& is a single file holding a collection of
35other files in a structure that makes it possible to retrieve
36the original individual files (called \c
37.I members\c
38\& of the archive).
39
40The original files' contents, mode (permissions), timestamp, owner, and
41group are preserved in the archive, and may be reconstituted on
42extraction.
43
44GNU \c
45.B ar\c
46\& can maintain archives whose members have names of any
47length; however, depending on how \c
48.B ar\c
49\& is configured on your
50system, a limit on member-name length may be imposed (for compatibility
51with archive formats maintained with other tools). If it exists, the
52limit is often 15 characters (typical of formats related to a.out) or 16
53characters (typical of formats related to coff).
54
55\c
56.B ar\c
57\& is considered a binary utility because archives of this sort
58are most often used as \c
59.I libraries\c
60\& holding commonly needed
61subroutines.
62
63\c
64.B ar\c
65\& will create an index to the symbols defined in relocatable
66object modules in the archive when you specify the modifier `\|\c
67.B s\c
68\|'.
69Once created, this index is updated in the archive whenever \c
70.B ar\c
71\&
72makes a change to its contents (save for the `\|\c
73.B q\c
74\|' update operation).
75An archive with such an index speeds up linking to the library, and
76allows routines in the library to call each other without regard to
77their placement in the archive.
78
79You may use `\|\c
80.B nm \-s\c
81\|' or `\|\c
82.B nm \-\-print\-armap\c
83\|' to list this index
84table. If an archive lacks the table, another form of \c
85.B ar\c
86\& called
87\c
88.B ranlib\c
89\& can be used to add just the table.
90
91\c
92.B ar\c
93\& insists on at least two arguments to execute: one
94keyletter specifying the \c
95.I operation\c
96\& (optionally accompanied by other
97keyletters specifying \c
98.I modifiers\c
99\&), and the archive name to act on.
100
101Most operations can also accept further \c
102.I files\c
103\& arguments,
104specifying particular files to operate on.
105
106.SH OPTIONS
107GNU \c
108.B ar\c
109\& allows you to mix the operation code \c
110.I p\c
111\& and modifier
112flags \c
113.I mod\c
114\& in any order, within the first command-line argument.
115
116If you wish, you may begin the first command-line argument with a
117dash.
118
119The \c
120.I p\c
121\& keyletter specifies what operation to execute; it may be
122any of the following, but you must specify only one of them:
123
124.TP
125.B d
126\c
127.I Delete\c
128\& modules from the archive. Specify the names of modules to
129be deleted as \c
130.I files\c
131\&; the archive is untouched if you
132specify no files to delete.
133
134If you specify the `\|\c
135.B v\c
136\|' modifier, \c
137.B ar\c
138\& will list each module
139as it is deleted.
140
141.TP
142.B m
143Use this operation to \c
144.I move\c
145\& members in an archive.
146
147The ordering of members in an archive can make a difference in how
148programs are linked using the library, if a symbol is defined in more
149than one member.
150
151If no modifiers are used with \c
152.B m\c
153\&, any members you name in the
154\c
155.I files\c
156\& arguments are moved to the \c
157.I end\c
158\& of the archive;
159you can use the `\|\c
160.B a\c
161\|', `\|\c
162.B b\c
163\|', or `\|\c
164.B i\c
165\|' modifiers to move them to a
166specified place instead.
167
168.TP
169.B p
170\c
171.I Print\c
172\& the specified members of the archive, to the standard
173output file. If the `\|\c
174.B v\c
175\|' modifier is specified, show the member
176name before copying its contents to standard output.
177
178If you specify no \c
179.I files\c
180\&, all the files in the archive are printed.
181
182.TP
183.B q
184\c
185.I Quick append\c
186\&; add \c
187.I files\c
188\& to the end of \c
189.I archive\c
190\&,
191without checking for replacement.
192
193The modifiers `\|\c
194.B a\c
195\|', `\|\c
196.B b\c
197\|', and `\|\c
198.B i\c
199\|' do \c
200.I not\c
201\& affect this
202operation; new members are always placed at the end of the archive.
203
204The modifier `\|\c
205.B v\c
206\|' makes \c
207.B ar\c
208\& list each file as it is appended.
209
210Since the point of this operation is speed, the archive's symbol table
211index is not updated, even if it already existed; you can use `\|\c
212.B ar s\c
213\|' or
214\c
215.B ranlib\c
216\& explicitly to update the symbol table index.
217
218However, too many different systems assume quick append rebuilds the
219index, so GNU
220.B ar
221implements `\|\c
222.B q\c
223\|' as a synonym for `\|\c
224.B r\c
225\|'.
226
227.TP
228.B r
229Insert \c
230.I files\c
231\& into \c
232.I archive\c
233\& (with \c
234.I replacement\c
235\&). This
236operation differs from `\|\c
237.B q\c
238\|' in that any previously existing members
239are deleted if their names match those being added.
240
241If one of the files named in \c
242.I files\c
243\& doesn't exist, \c
244.B ar\c
245\&
246displays an error message, and leaves undisturbed any existing members
247of the archive matching that name.
248
249By default, new members are added at the end of the file; but you may
250use one of the modifiers `\|\c
251.B a\c
252\|', `\|\c
253.B b\c
254\|', or `\|\c
255.B i\c
256\|' to request
257placement relative to some existing member.
258
259The modifier `\|\c
260.B v\c
261\|' used with this operation elicits a line of
262output for each file inserted, along with one of the letters `\|\c
263.B a\c
264\|' or
265`\|\c
266.B r\c
267\|' to indicate whether the file was appended (no old member
268deleted) or replaced.
269
270.TP
271.B t
272Display a \c
273.I table\c
274\& listing the contents of \c
275.I archive\c
276\&, or those
277of the files listed in \c
278.I files\c
279\& that are present in the
280archive. Normally only the member name is shown; if you also want to
281see the modes (permissions), timestamp, owner, group, and size, you can
282request that by also specifying the `\|\c
283.B v\c
284\|' modifier.
285
286If you do not specify any \c
287.I files\c
288\&, all files in the archive
289are listed.
290
291If there is more than one file with the same name (say, `\|\c
292.B fie\c
293\|') in
294an archive (say `\|\c
295.B b.a\c
296\|'), `\|\c
297.B ar t b.a fie\c
298\|' will list only the
299first instance; to see them all, you must ask for a complete
300listing\(em\&in our example, `\|\c
301.B ar t b.a\c
302\|'.
303
304.TP
305.B x
306\c
307.I Extract\c
308\& members (named \c
309.I files\c
310\&) from the archive. You can
311use the `\|\c
312.B v\c
313\|' modifier with this operation, to request that
314\c
315.B ar\c
316\& list each name as it extracts it.
317
318If you do not specify any \c
319.I files\c
320\&, all files in the archive
321are extracted.
322
323.PP
324
325A number of modifiers (\c
326.I mod\c
327\&) may immediately follow the \c
328.I p\c
329\&
330keyletter, to specify variations on an operation's behavior:
331
332.TP
333.B a
334Add new files \c
335.I after\c
336\& an existing member of the
337archive. If you use the modifier \c
338.B a\c
339\&, the name of an existing archive
340member must be present as the \c
341.I membername\c
342\& argument, before the
343\c
344.I archive\c
345\& specification.
346
347.TP
348.B b
349Add new files \c
350.I before\c
351\& an existing member of the
352archive. If you use the modifier \c
353.B b\c
354\&, the name of an existing archive
355member must be present as the \c
356.I membername\c
357\& argument, before the
358\c
359.I archive\c
360\& specification. (same as `\|\c
361.B i\c
362\|').
363
364.TP
365.B c
366\c
367.I Create\c
368\& the archive. The specified \c
369.I archive\c
370\& is always
371created if it didn't exist, when you request an update. But a warning is
372issued unless you specify in advance that you expect to create it, by
373using this modifier.
374
375.TP
376.B f
377Truncate names in the archive.
378.B ar
379will normally permit file names of any length. This will cause it to
380create archives which are not compatible with the native
381.B ar
382program on some systems. If this is a concern, the
383.B f
384modifier may be used to truncate file names when putting them in the
385archive.
386
fe84ea5d
ILT
387.TP
388.B P
389Use the full path name when matching names in the archive.
390.B ar
391can not create an archive with a full path name (such archives are not
392POSIX complaint), but other archive creators can. This option will
393cause
394.B ar
395to match file names using a complete path name, which can be
396convenient when extracting a single file from an archive created by
397another tool.
398
252b5132
RH
399.TP
400.B i
401Insert new files \c
402.I before\c
403\& an existing member of the
404archive. If you use the modifier \c
405.B i\c
406\&, the name of an existing archive
407member must be present as the \c
408.I membername\c
409\& argument, before the
410\c
411.I archive\c
412\& specification. (same as `\|\c
413.B b\c
414\|').
415
416.TP
417.B l
418This modifier is accepted but not used.
419
420.TP
421.B o
422Preserve the \c
423.I original\c
424\& dates of members when extracting them. If
425you do not specify this modifier, files extracted from the archive
426will be stamped with the time of extraction.
427
428.TP
429.B s
430Write an object-file index into the archive, or update an existing one,
431even if no other change is made to the archive. You may use this modifier
432flag either with any operation, or alone. Running `\|\c
433.B ar s\c
434\|' on an
435archive is equivalent to running `\|\c
436.B ranlib\c
437\|' on it.
438
439.TP
440.B S
441Do not generate an archive symbol table. This can speed up building a
442large library in several steps. The resulting archive can not be used
443with the linker. In order to build a symbol table, you must omit the
444`\|\c
445.B S\c
446\|' modifier on the last execution of `\|\c
447.B ar\c
448\|', or you must run `\|\c
449.B ranlib\c
450\|' on the archive.
451
452.TP
453.B u
454Normally, \c
455.B ar r\c
456\&.\|.\|. inserts all files
457listed into the archive. If you would like to insert \c
458.I only\c
459\& those
460of the files you list that are newer than existing members of the same
461names, use this modifier. The `\|\c
462.B u\c
463\|' modifier is allowed only for the
464operation `\|\c
465.B r\c
466\|' (replace). In particular, the combination `\|\c
467.B qu\c
468\|' is
469not allowed, since checking the timestamps would lose any speed
470advantage from the operation `\|\c
471.B q\c
472\|'.
473
474.TP
475.B v
476This modifier requests the \c
477.I verbose\c
478\& version of an operation. Many
479operations display additional information, such as filenames processed,
480when the modifier `\|\c
481.B v\c
482\|' is appended.
483
484.TP
485.B V
486This modifier shows the version number of
487.BR ar .
488
489.PP
490
491.SH "SEE ALSO"
492.RB "`\|" binutils "\|'"
493entry in
494.B
495info\c
496\&;
497.I
498The GNU Binary Utilities\c
499, Roland H. Pesch (October 1991).
500.BR nm ( 1 )\c
501\&,
502.BR ranlib ( 1 )\c
503\&.
504
505.SH COPYING
fe84ea5d 506Copyright (c) 1991, 1992, 1993, 1995, 1998, 1999 Free Software Foundation, Inc.
252b5132
RH
507.PP
508Permission is granted to make and distribute verbatim copies of
509this manual provided the copyright notice and this permission notice
510are preserved on all copies.
511.PP
512Permission is granted to copy and distribute modified versions of this
513manual under the conditions for verbatim copying, provided that the
514entire resulting derived work is distributed under the terms of a
515permission notice identical to this one.
516.PP
517Permission is granted to copy and distribute translations of this
518manual into another language, under the above conditions for modified
519versions, except that this permission notice may be included in
520translations approved by the Free Software Foundation instead of in
521the original English.
This page took 0.060542 seconds and 4 git commands to generate.