AR 1 2005-04-20 binutils-2.15.97 GNU Development Tools

NAME

ar - create, modify, and extract from archives

SYNOPSIS

ar [--XX3322__6644] [--]_p[_m_o_d [_r_e_l_p_o_s] [_c_o_u_n_t]] _a_r_c_h_i_v_e [_m_e_m_b_e_r...]

DESCRIPTION

The GNU aarr program creates, modifies, and extracts from archives. An _a_r_c_h_i_v_e is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called _m_e_m_b_e_r_s of the archive).

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

GNU aarr can maintain archives whose members have names of any length; however, depending on how aarr 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).

aarr is considered a binary utility because archives of this sort are most often used as _l_i_b_r_a_r_i_e_s holding commonly needed subroutines.

aarr creates an index to the symbols defined in relocatable object modules in the archive when you specify the modifier ss. Once created, this index is updated in the archive whenever aarr makes a change to its contents (save for the qq 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 nnmm --ss or nnmm ----pprriinntt--aarrmmaapp to list this index table. If an archive lacks the table, another form of aarr called rraannlliibb can be used to add just the table.

GNU aarr is designed to be compatible with two different facilities. You can control its activity using command-line options, like the different varieties of aarr on Unix systems; or, if you specify the single command-line option --MM, you can control it with a script supplied via standard input, like the MRI ``librarian'' program.

OPTIONS

GNU aarr allows you to mix the operation code _p and modifier flags _m_o_d in any order, within the first command-line argument.

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

The _p keyletter specifies what operation to execute; it may be any of the following, but you must specify only one of them:

dd _D_e_l_e_t_e modules from the archive. Specify the names of modules to
be deleted as _m_e_m_b_e_r...; the archive is untouched if you specify no files to delete.

If you specify the vv modifier, aarr lists each module as it is deleted.
mm Use this operation to _m_o_v_e 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 "m", any members you name in the _m_e_m_b_e_r arguments are moved to the _e_n_d of the archive; you can use the aa, bb, or ii modifiers to move them to a specified place instead.
pp _P_r_i_n_t the specified members of the archive, to the standard
output file. If the vv modifier is specified, show the member name before copying its contents to standard output.

If you specify no _m_e_m_b_e_r arguments, all the files in the archive are printed.
qq _Q_u_i_c_k _a_p_p_e_n_d; Historically, add the files _m_e_m_b_e_r... to the end of
_a_r_c_h_i_v_e, without checking for replacement.

The modifiers aa, bb, and ii do _n_o_t affect this operation; new members are always placed at the end of the archive.

The modifier vv makes aarr 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 aarr ss or rraannlliibb explicitly to update the symbol table index.

However, too many different systems assume quick append rebuilds the index, so GNU aarr implements qq as a synonym for rr.
rr Insert the files _m_e_m_b_e_r... into _a_r_c_h_i_v_e (with
_r_e_p_l_a_c_e_m_e_n_t). This operation differs from qq in that any previously existing members are deleted if their names match those being added.

If one of the files named in _m_e_m_b_e_r... does not exist, aarr 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 aa, bb, or ii to request placement relative to some existing member.

The modifier vv used with this operation elicits a line of output for each file inserted, along with one of the letters aa or rr to indicate whether the file was appended (no old member deleted) or replaced.
tt Display a _t_a_b_l_e listing the contents of _a_r_c_h_i_v_e, or those
of the files listed in _m_e_m_b_e_r... 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 vv modifier.

If you do not specify a _m_e_m_b_e_r, all files in the archive are listed.

If there is more than one file with the same name (say, ffiiee) in an archive (say bb..aa), aarr tt bb..aa ffiiee lists only the first instance; to see them all, you must ask for a complete listing---in our example, aarr tt bb..aa.
xx _E_x_t_r_a_c_t members (named _m_e_m_b_e_r) from the archive. You can
use the vv modifier with this operation, to request that aarr list each name as it extracts it.

If you do not specify a _m_e_m_b_e_r, all files in the archive are extracted.

A number of modifiers (_m_o_d) may immediately follow the _p keyletter, to specify variations on an operation's behavior:

aa Add new files _a_f_t_e_r an existing member of the
archive. If you use the modifier aa, the name of an existing archive member must be present as the _r_e_l_p_o_s argument, before the _a_r_c_h_i_v_e specification.
bb Add new files _b_e_f_o_r_e an existing member of the
archive. If you use the modifier bb, the name of an existing archive member must be present as the _r_e_l_p_o_s argument, before the _a_r_c_h_i_v_e specification. (same as ii).
cc _C_r_e_a_t_e the archive. The specified _a_r_c_h_i_v_e is always
created if it did not 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.
ff Truncate names in the archive. GNU aarr will normally permit file
names of any length. This will cause it to create archives which are not compatible with the native aarr program on some systems. If this is a concern, the ff modifier may be used to truncate file names when putting them in the archive.
ii Insert new files _b_e_f_o_r_e an existing member of the
archive. If you use the modifier ii, the name of an existing archive member must be present as the _r_e_l_p_o_s argument, before the _a_r_c_h_i_v_e specification. (same as bb).
ll This modifier is accepted but not used.
NN Uses the _c_o_u_n_t parameter. This is used if there are multiple
entries in the archive with the same name. Extract or delete instance _c_o_u_n_t of the given name from the archive.
oo Preserve the _o_r_i_g_i_n_a_l dates of members when extracting them. If
you do not specify this modifier, files extracted from the archive are stamped with the time of extraction.
PP Use the full path name when matching names in the archive. GNU
aarr can not create an archive with a full path name (such archives are not POSIX complaint), but other archive creators can. This option will cause GNU aarr to match file names using a complete path name, which can be convenient when extracting a single file from an archive created by another tool.
ss 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 aarr ss on an archive is equivalent to running rraannlliibb on it.
SS 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 SS modifier on the last execution of aarr, or you must run rraannlliibb on the archive.
uu Normally, aarr rr... inserts all files
listed into the archive. If you would like to insert _o_n_l_y those of the files you list that are newer than existing members of the same names, use this modifier. The uu modifier is allowed only for the operation rr (replace). In particular, the combination qquu is not allowed, since checking the timestamps would lose any speed advantage from the operation qq.
vv This modifier requests the _v_e_r_b_o_s_e version of an operation. Many
operations display additional information, such as filenames processed, when the modifier vv is appended.
VV This modifier shows the version number of aarr.

aarr ignores an initial option spelt --XX3322__6644, for compatibility with AIX. The behaviour produced by this option is the default for GNU aarr. aarr does not support any of the other --XX options; in particular, it does not support --XX3322 which is the default for AIX aarr.

SEE ALSO

_n_m(1), _r_a_n_l_i_b(1), and the Info entries for _b_i_n_u_t_i_l_s. Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.