Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
ar(1)
Edit
PageHistory
Diff
Info
LikePages
AR !!!AR NAME SYNOPSIS DESCRIPTION OPTIONS SEE ALSO COPYRIGHT ---- !!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 from archives. An ''archive'' is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called ''members'' 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 __ar__ can maintain archives whose members have names of any length; however, depending on how __ar__ 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). __ar__ is considered a binary utility because archives of this sort are most often used as ''libraries'' holding commonly needed subroutines. __ar__ creates an index to the symbols defined in relocatable object modules in the archive when you specify the modifier __s__. Once created, this index is updated in the archive whenever __ar__ makes a change to its contents (save for the __q__ 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 __nm -s__ or __nm --print-armap__ to list this index table. If an archive lacks the table, another form of __ar__ called __ranlib__ can be used to add just the table. GNU __ar__ is designed to be compatible with two different facilities. You can control its activity using command-line options, like the different varieties of __ar__ on Unix systems; or, if you specify the single command-line option __-M__, you can control it with a script supplied via standard input, like the MRI ``librarian'' program. !!OPTIONS GNU __ar__ allows you to mix the operation code ''p'' and modifier flags ''mod'' 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: __d__ ''Delete'' modules from the archive. Specify the names of modules to be deleted as ''member''...; the archive is untouched if you specify no files to delete. If you specify the __v__ modifier, __ar__ lists each module as 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 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 ''member'' arguments are moved to the ''end'' of the archive; you can use the __a__, __b__, or __i__ modifiers to move them to a specified place instead. __p__ ''Print'' the specified members of the archive, to the standard output file. If the __v__ modifier is specified, show the member name before copying its contents to standard output. If you specify no ''member'' arguments, all the files in the archive are printed. __q__ ''Quick append''; Historically, add the files ''member''... to the end of ''archive'', without checking for replacement. The modifiers __a__, __b__, and __i__ do ''not'' affect this operation; 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 table index is not updated, even if it already existed; you can use __ar s__ or __ranlib__ explicitly to update the symbol table index. However, too many different systems assume quick append rebuilds the index, so GNU ar implements q as a synonym for r. __r__ Insert the files ''member''... into ''archive'' (with ''replacement''). This operation differs from __q__ in that any previously existing members are deleted if their names match those being added. If one of the files named in ''member''... does not exist, __ar__ 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 __a__, __b__, or __i__ to request placement relative to some existing member. The modifier __v__ used with this operation elicits a line of output for each file inserted, along with one of the letters __a__ or __r__ to indicate whether the file was appended (no old member deleted) or replaced. __t__ Display a ''table'' listing the contents of ''archive'', or those of the files listed in ''member''... 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 __v__ modifier. If you do not specify a ''member'', all files in the archive are listed. If there is more than one file with the same name (say, __fie__) in an archive (say __b.a__), __ar t b.a fie__ lists only the first instance; to see them all, you must ask for a complete listing---in our example, __ar t b.a__. __x__ ''Extract'' members (named ''member'') from the archive. You can use the __v__ modifier with this operation, to request that __ar__ list each name as it extracts it. If you do not specify a ''member'', all files in the archive are extracted. A number of modifiers (''mod'') may immediately follow the ''p'' keyletter, to specify variations on an operation's behavior: __a__ Add new files ''after'' an existing member of the archive. If you use the modifier __a__, the name of an existing archive member must be present as the ''relpos'' argument, before the ''archive'' specification. __b__ Add new files ''before'' an existing member of the archive. If you use the modifier __b__, the name of an existing archive member must be present as the ''relpos'' argument, before the ''archive'' specification. (same as __i__). __c__ ''Create'' the archive. The specified ''archive'' 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. __f__ Truncate names in the archive. GNU __ar__ will normally permit file names of any length. This will cause it to create archives which are not compatible with the native __ar__ program on some systems. If this is a concern, the __f__ modifier may be used to truncate file names when putting them in the archive. __i__ Insert new files ''before'' an existing member of the archive. If you use the modifier __i__, the name of an existing archive member must be present as the ''relpos'' argument, before the ''archive'' specification. (same as __b__). __l__ This modifier is accepted but not used. __N__ Uses the ''count'' parameter. This is used if there are multiple entries in the archive with the same name. Extract or delete instance ''count'' of the given name from the archive. __o__ Preserve the ''original'' 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. __P__ Use the full path name when matching names in the archive. GNU __ar__ 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 __ar__ 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. __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 __ar s__ on an archive is equivalent to running __ranlib__ on it. __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 __S__ modifier on the last execution of __ar__, or you must run __ranlib__ on the archive. __u__ Normally, __ar r__... inserts all files listed into the archive. If you would like to insert ''only'' those of the files you list that are newer than existing members of the same names, use this modifier. The __u__ modifier is allowed only for the operation __r__ (replace). In particular, the combination __qu__ is not allowed, since checking the timestamps would lose any speed advantage from the operation __q__. __v__ This modifier requests the ''verbose'' version of an operation. Many operations 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__, for compatibility with AIX . The behaviour produced by this option is the default for GNU __ar__. __ar__ does not support any of the other __-X__ options; in particular, it does not support __-X32__ which 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 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''. ----
11 pages link to
ar(1)
:
ld(1)
uselib(2)
Man1a
lorder(1)
nm(1)
ranlib(1)
size(1)
strings(1)
CompilingHowto
Deb
TwoLetterCommands
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.