SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from Trustix binutils-2.13.2-3tr.i586.rpm

AR

Section: GNU Development Tools (1)
Updated: 2002-08-05
Index 

NAME

ar - create, modify, and extract from archives 

SYNOPSIS

ar [-X32_64] [-]p[mod [relpos] [count]] archive [member...] 

DESCRIPTION

The GNU ar program creates, modifies, and extracts fromarchives. An archive is a single file holding a collection ofother files in a structure that makes it possible to retrievethe original individual files (called members of the archive).

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

GNU ar can maintain archives whose members have names of anylength; however, depending on how ar is configured on yoursystem, a limit on member-name length may be imposed for compatibilitywith archive formats maintained with other tools. If it exists, thelimit is often 15 characters (typical of formats related to a.out) or 16characters (typical of formats related to coff).

ar is considered a binary utility because archives of this sortare most often used as libraries holding commonly neededsubroutines.

ar creates an index to the symbols defined in relocatableobject modules in the archive when you specify the modifier s.Once created, this index is updated in the archive whenever armakes a change to its contents (save for the q update operation).An archive with such an index speeds up linking to the library, andallows routines in the library to call each other without regard totheir placement in the archive.

You may use nm -s or nm --print-armap to list this indextable. If an archive lacks the table, another form of ar calledranlib can be used to add just the table.

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

OPTIONS

GNU ar allows you to mix the operation code p and modifierflags mod in any order, within the first command-line argument.

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

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

d
Delete modules from the archive. Specify the names of modules tobe deleted as member...; the archive is untouched if youspecify no files to delete.

If you specify the v modifier, ar lists each moduleas it is deleted.

m
Use this operation to move members in an archive.

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

If no modifiers are used with "m", any members you name in themember arguments are moved to the end of the archive;you can use the a, b, or i modifiers to move them to aspecified place instead.

p
Print the specified members of the archive, to the standardoutput file. If the v modifier is specified, show the membername before copying its contents to standard output.

If you specify no member arguments, all the files in the archive areprinted.

q
Quick append; Historically, add the files member... to the end ofarchive, without checking for replacement.

The modifiers a, b, and i do not affect thisoperation; new members are always placed at the end of the archive.

The modifier v makes ar list each file as it is appended.

Since the point of this operation is speed, the archive's symbol tableindex is not updated, even if it already existed; you can use ar s orranlib explicitly to update the symbol table index.

However, too many different systems assume quick append rebuilds theindex, so GNU ar implements "q" as a synonym for "r".

r
Insert the files member... into archive (withreplacement). This operation differs from q in that anypreviously existing members are deleted if their names match those beingadded.

If one of the files named in member... does not exist, ardisplays an error message, and leaves undisturbed any existing membersof the archive matching that name.

By default, new members are added at the end of the file; but you mayuse one of the modifiers a, b, or i to requestplacement relative to some existing member.

The modifier v used with this operation elicits a line ofoutput for each file inserted, along with one of the letters a orr to indicate whether the file was appended (no old memberdeleted) or replaced.

t
Display a table listing the contents of archive, or thoseof the files listed in member... that are present in thearchive. Normally only the member name is shown; if you also want tosee the modes (permissions), timestamp, owner, group, and size, you canrequest that by also specifying the v modifier.

If you do not specify a member, all files in the archiveare listed.

If there is more than one file with the same name (say, fie) inan archive (say b.a), ar t b.a fie lists only thefirst instance; to see them all, you must ask for a completelisting---in our example, ar t b.a.

x
Extract members (named member) from the archive. You canuse the v modifier with this operation, to request thatar list each name as it extracts it.

If you do not specify a member, all files in the archiveare extracted.

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

a
Add new files after an existing member of thearchive. If you use the modifier a, the name of an existing archivemember must be present as the relpos argument, before thearchive specification.
b
Add new files before an existing member of thearchive. If you use the modifier b, the name of an existing archivemember must be present as the relpos argument, before thearchive specification. (same as i).
c
Create the archive. The specified archive is alwayscreated if it did not exist, when you request an update. But a warning isissued unless you specify in advance that you expect to create it, byusing this modifier.
f
Truncate names in the archive. GNU ar will normally permit filenames of any length. This will cause it to create archives which arenot compatible with the native ar program on some systems. Ifthis is a concern, the f modifier may be used to truncate filenames when putting them in the archive.
i
Insert new files before an existing member of thearchive. If you use the modifier i, the name of an existing archivemember must be present as the relpos argument, before thearchive specification. (same as b).
l
This modifier is accepted but not used.
N
Uses the count parameter. This is used if there are multipleentries in the archive with the same name. Extract or delete instancecount of the given name from the archive.
o
Preserve the original dates of members when extracting them. Ifyou do not specify this modifier, files extracted from the archiveare stamped with the time of extraction.
P
Use the full path name when matching names in the archive. GNUar can not create an archive with a full path name (such archivesare not POSIX complaint), but other archive creators can. This optionwill cause GNU ar to match file names using a complete pathname, which can be convenient when extracting a single file from anarchive created by another tool.
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 modifierflag either with any operation, or alone. Running ar s on anarchive is equivalent to running ranlib on it.
S
Do not generate an archive symbol table. This can speed up building alarge library in several steps. The resulting archive can not be usedwith the linker. In order to build a symbol table, you must omit theS modifier on the last execution of ar, or you must runranlib on the archive.
u
Normally, ar r... inserts all fileslisted into the archive. If you would like to insert only thoseof the files you list that are newer than existing members of the samenames, use this modifier. The u modifier is allowed only for theoperation r (replace). In particular, the combination qu isnot allowed, since checking the timestamps would lose any speedadvantage from the operation q.
v
This modifier requests the verbose version of an operation. Manyoperations display additional information, such as filenames processed,when the modifier v is appended.
V
This modifier shows the version number of ar.

ar ignores an initial option spelt -X32_64, forcompatibility with AIX. The behaviour produced by this option is thedefault for GNU ar. ar does not support any of the other-X options; in particular, it does not support -X32which is the default for AIX ar. 

SEE ALSO

nm(1), ranlib(1), and the Info entries for binutils. 

COPYRIGHT

Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002 Free Software Foundation, Inc.

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


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
SEE ALSO
COPYRIGHT

This document was created byman2html,using the manual pages.