You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
6.5 KiB
HTML
121 lines
6.5 KiB
HTML
4 years ago
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>ar - GNU Binary Utilities</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="GNU Binary Utilities">
|
||
|
<meta name="generator" content="makeinfo 4.13">
|
||
|
<link title="Top" rel="start" href="index.html#Top">
|
||
|
<link rel="prev" href="index.html#Top" title="Top">
|
||
|
<link rel="next" href="nm.html#nm" title="nm">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
Copyright (C) 1991-2015 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.3
|
||
|
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''.
|
||
|
|
||
|
-->
|
||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||
|
<style type="text/css"><!--
|
||
|
pre.display { font-family:inherit }
|
||
|
pre.format { font-family:inherit }
|
||
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
||
|
pre.smallexample { font-size:smaller }
|
||
|
pre.smalllisp { font-size:smaller }
|
||
|
span.sc { font-variant:small-caps }
|
||
|
span.roman { font-family:serif; font-weight:normal; }
|
||
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<a name="ar"></a>
|
||
|
<p>
|
||
|
Next: <a rel="next" accesskey="n" href="nm.html#nm">nm</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="index.html#Top">Top</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
||
|
<hr>
|
||
|
</div>
|
||
|
|
||
|
<h2 class="chapter">1 ar</h2>
|
||
|
|
||
|
<p><a name="index-ar-2"></a><a name="index-archives-3"></a><a name="index-collections-of-files-4"></a>
|
||
|
<!-- man title ar create, modify, and extract from archives -->
|
||
|
|
||
|
<pre class="smallexample"> ar [-]<var>p</var>[<var>mod</var>] [<samp><span class="option">--plugin</span></samp> <var>name</var>] [<samp><span class="option">--target</span></samp> <var>bfdname</var>] [<var>relpos</var>] [<var>count</var>] <var>archive</var> [<var>member</var>...]
|
||
|
ar -M [ <mri-script ]
|
||
|
</pre>
|
||
|
<!-- man begin DESCRIPTION ar -->
|
||
|
<p>The <span class="sc">gnu</span> <samp><span class="command">ar</span></samp> program creates, modifies, and extracts from
|
||
|
archives. An <dfn>archive</dfn> is a single file holding a collection of
|
||
|
other files in a structure that makes it possible to retrieve
|
||
|
the original individual files (called <dfn>members</dfn> of the archive).
|
||
|
|
||
|
<p>The original files' contents, mode (permissions), timestamp, owner, and
|
||
|
group are preserved in the archive, and can be restored on
|
||
|
extraction.
|
||
|
|
||
|
<p><a name="index-name-length-5"></a><span class="sc">gnu</span> <samp><span class="command">ar</span></samp> can maintain archives whose members have names of any
|
||
|
length; however, depending on how <samp><span class="command">ar</span></samp> 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).
|
||
|
|
||
|
<p><a name="index-libraries-6"></a><samp><span class="command">ar</span></samp> is considered a binary utility because archives of this sort
|
||
|
are most often used as <dfn>libraries</dfn> holding commonly needed
|
||
|
subroutines.
|
||
|
|
||
|
<p><a name="index-symbol-index-7"></a><samp><span class="command">ar</span></samp> creates an index to the symbols defined in relocatable
|
||
|
object modules in the archive when you specify the modifier ‘<samp><span class="samp">s</span></samp>’.
|
||
|
Once created, this index is updated in the archive whenever <samp><span class="command">ar</span></samp>
|
||
|
makes a change to its contents (save for the ‘<samp><span class="samp">q</span></samp>’ 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.
|
||
|
|
||
|
<p>You may use ‘<samp><span class="samp">nm -s</span></samp>’ or ‘<samp><span class="samp">nm --print-armap</span></samp>’ to list this index
|
||
|
table. If an archive lacks the table, another form of <samp><span class="command">ar</span></samp> called
|
||
|
<samp><span class="command">ranlib</span></samp> can be used to add just the table.
|
||
|
|
||
|
<p><a name="index-thin-archives-8"></a><span class="sc">gnu</span> <samp><span class="command">ar</span></samp> can optionally create a <em>thin</em> archive,
|
||
|
which contains a symbol index and references to the original copies
|
||
|
of the member files of the archive. This is useful for building
|
||
|
libraries for use within a local build tree, where the relocatable
|
||
|
objects are expected to remain available, and copying the contents of
|
||
|
each object would only waste time and space.
|
||
|
|
||
|
<p>An archive can either be <em>thin</em> or it can be normal. It cannot
|
||
|
be both at the same time. Once an archive is created its format
|
||
|
cannot be changed without first deleting it and then creating a new
|
||
|
archive in its place.
|
||
|
|
||
|
<p>Thin archives are also <em>flattened</em>, so that adding one thin
|
||
|
archive to another thin archive does not nest it, as would happen with
|
||
|
a normal archive. Instead the elements of the first archive are added
|
||
|
individually to the second archive.
|
||
|
|
||
|
<p>The paths to the elements of the archive are stored relative to the
|
||
|
archive itself.
|
||
|
|
||
|
<p><a name="index-compatibility_002c-_0040command_007bar_007d-9"></a><a name="index-g_t_0040command_007bar_007d-compatibility-10"></a><span class="sc">gnu</span> <samp><span class="command">ar</span></samp> is designed to be compatible with two different
|
||
|
facilities. You can control its activity using command-line options,
|
||
|
like the different varieties of <samp><span class="command">ar</span></samp> on Unix systems; or, if you
|
||
|
specify the single command-line option <samp><span class="option">-M</span></samp>, you can control it
|
||
|
with a script supplied via standard input, like the MRI “librarian”
|
||
|
program.
|
||
|
|
||
|
<!-- man end -->
|
||
|
<ul class="menu">
|
||
|
<li><a accesskey="1" href="ar-cmdline.html#ar-cmdline">ar cmdline</a>: Controlling <samp><span class="command">ar</span></samp> on the command line
|
||
|
<li><a accesskey="2" href="ar-scripts.html#ar-scripts">ar scripts</a>: Controlling <samp><span class="command">ar</span></samp> with a script
|
||
|
</ul>
|
||
|
|
||
|
</body></html>
|
||
|
|