1<html lang="en"> 2<head> 3<title>ar - GNU Binary Utilities</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="GNU Binary Utilities"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="index.html#Top" title="Top"> 9<link rel="next" href="nm.html#nm" title="nm"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1991-2013 Free Software Foundation, Inc. 13 14Permission is granted to copy, distribute and/or modify this document 15under the terms of the GNU Free Documentation License, Version 1.3 16or any later version published by the Free Software Foundation; 17with no Invariant Sections, with no Front-Cover Texts, and with no 18Back-Cover Texts. A copy of the license is included in the 19section entitled ``GNU Free Documentation License''. 20 21--> 22<meta http-equiv="Content-Style-Type" content="text/css"> 23<style type="text/css"><!-- 24 pre.display { font-family:inherit } 25 pre.format { font-family:inherit } 26 pre.smalldisplay { font-family:inherit; font-size:smaller } 27 pre.smallformat { font-family:inherit; font-size:smaller } 28 pre.smallexample { font-size:smaller } 29 pre.smalllisp { font-size:smaller } 30 span.sc { font-variant:small-caps } 31 span.roman { font-family:serif; font-weight:normal; } 32 span.sansserif { font-family:sans-serif; font-weight:normal; } 33--></style> 34<link rel="stylesheet" type="text/css" href="../cs.css"> 35</head> 36<body> 37<div class="node"> 38<a name="ar"></a> 39<p> 40Next: <a rel="next" accesskey="n" href="nm.html#nm">nm</a>, 41Previous: <a rel="previous" accesskey="p" href="index.html#Top">Top</a>, 42Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 43<hr> 44</div> 45 46<h2 class="chapter">1 ar</h2> 47 48<p><a name="index-ar-2"></a><a name="index-archives-3"></a><a name="index-collections-of-files-4"></a> 49<!-- man title ar create, modify, and extract from archives --> 50 51<pre class="smallexample"> ar [<samp><span class="option">--plugin</span></samp> <var>name</var>] [-]<var>p</var>[<var>mod</var> [<var>relpos</var>] [<var>count</var>]] [<samp><span class="option">--target</span></samp> <var>bfdname</var>] <var>archive</var> [<var>member</var>...] 52 ar -M [ <mri-script ] 53</pre> 54 <!-- man begin DESCRIPTION ar --> 55 <p>The <span class="sc">gnu</span> <samp><span class="command">ar</span></samp> program creates, modifies, and extracts from 56archives. An <dfn>archive</dfn> is a single file holding a collection of 57other files in a structure that makes it possible to retrieve 58the original individual files (called <dfn>members</dfn> of the archive). 59 60 <p>The original files' contents, mode (permissions), timestamp, owner, and 61group are preserved in the archive, and can be restored on 62extraction. 63 64 <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 65length; however, depending on how <samp><span class="command">ar</span></samp> is configured on your 66system, a limit on member-name length may be imposed for compatibility 67with archive formats maintained with other tools. If it exists, the 68limit is often 15 characters (typical of formats related to a.out) or 16 69characters (typical of formats related to coff). 70 71 <p><a name="index-libraries-6"></a><samp><span class="command">ar</span></samp> is considered a binary utility because archives of this sort 72are most often used as <dfn>libraries</dfn> holding commonly needed 73subroutines. 74 75 <p><a name="index-symbol-index-7"></a><samp><span class="command">ar</span></samp> creates an index to the symbols defined in relocatable 76object modules in the archive when you specify the modifier ‘<samp><span class="samp">s</span></samp>’. 77Once created, this index is updated in the archive whenever <samp><span class="command">ar</span></samp> 78makes a change to its contents (save for the ‘<samp><span class="samp">q</span></samp>’ update operation). 79An archive with such an index speeds up linking to the library, and 80allows routines in the library to call each other without regard to 81their placement in the archive. 82 83 <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 84table. If an archive lacks the table, another form of <samp><span class="command">ar</span></samp> called 85<samp><span class="command">ranlib</span></samp> can be used to add just the table. 86 87 <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, 88which contains a symbol index and references to the original copies 89of the member files of the archive. This is useful for building 90libraries for use within a local build tree, where the relocatable 91objects are expected to remain available, and copying the contents of 92each object would only waste time and space. 93 94 <p>An archive can either be <em>thin</em> or it can be normal. It cannot 95be both at the same time. Once an archive is created its format 96cannot be changed without first deleting it and then creating a new 97archive in its place. 98 99 <p>Thin archives are also <em>flattened</em>, so that adding one thin 100archive to another thin archive does not nest it, as would happen with 101a normal archive. Instead the elements of the first archive are added 102individually to the second archive. 103 104 <p>The paths to the elements of the archive are stored relative to the 105archive itself. 106 107 <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 108facilities. You can control its activity using command-line options, 109like the different varieties of <samp><span class="command">ar</span></samp> on Unix systems; or, if you 110specify the single command-line option <samp><span class="option">-M</span></samp>, you can control it 111with a script supplied via standard input, like the MRI “librarian” 112program. 113 114<!-- man end --> 115<ul class="menu"> 116<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 117<li><a accesskey="2" href="ar-scripts.html#ar-scripts">ar scripts</a>: Controlling <samp><span class="command">ar</span></samp> with a script 118</ul> 119 120 </body></html> 121 122