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