blob: aff72fd372152164854a23cb62b63496acb99958 [file] [log] [blame]
Reid Spencere26ed7a2004-11-11 09:21:18 +00001=pod
2
3=head1 NAME
4
5llvm-ar - LLVM archiver
6
7=head1 SYNOPSIS
8
9B<llvm-ar> [-X32_64] [-]{dmpqrtx}[Rabfouz] [relpos] [count] <archive-file> [files...]
10
11
12=head1 DESCRIPTION
13
14The B<llvm-ar> command is similar to the common Unix utility, C<ar>. It
15archives several files together into a single file. The intent for this is
16to produce archive libraries by LLVM bytecode that can be linked into an
17LLVM program. However, the archive can contain any kind of file. If requested,
18B<llvm-ar> can generate a symbol table that makes linking faster because
19only the symbol table needs to be consulted, not each individual file member
20of the archive.
21
22While the B<llvm-ar> command produces files that are similar to the format
23used by older C<ar> implementations, it has several significant departures
24in order to make the archive appropriate for LLVM. Consequently, archives
25produced with B<llvm-ar> probably won't be readable or editable with any
26C<ar> implementation unless the archive content is very simple.
27
28Here's where B<llvm-ar> departs from previous C<ar> implementations:
29
30=over
31
32=item I<Symbol Table>
33
34Since B<llvm-ar> is intended to archive bytecode files, the symbol table
35won't make much sense to anything but LLVM. Consequently, the symbol table's
36format has been simplified. It consists simply of a sequence of pairs
37of a file member index number as an LSB 4byte integer and a null-terminated
38string.
39
40=item I<Long Paths>
41
42Some C<ar> implementations (SVR4) use a separate file member to record long
43path names (> 15 characters). B<llvm-ar> takes the BSD 4.4 and Mac OS X
44approach which is to simply store the full path name immediately preceding
45the data for the file. The path name is null terminated and may contain the
46slash (/) character.
47
48=item I<Compression>
49
50B<llvm-ar> can compress the members of an archive to save space. The
51compression used depends on what's available on the platform but favors
52bzip2 and then zlib. Note that for very small files, bzip2 may increase
53the file size but generally does about 10% better than zlib on LLVM
54bytecode files.
55
56=item I<Directory Recursion>
57
58Most C<ar> implementations do not recurse through directories but simply
59ignore directories if they are presented to the program in the F<files>
60option. B<llvm-ar>, however, can recurse through directory structures and
61add all the files under a directory, if requested.
62
63=item I<TOC Verbose Output>
64
65When B<llvm-ar> prints out the verbose table of contents (C<tv> option), it
66precedes the usual output with a character indicating the basic kind of
67content in the file. A blank means the file is a regular file. A 'Z' means
68the file is compressed. A 'B' means the file is an LLVM bytecode file. An
69'S' means the file is the symbol table.
70
71=back
72
73=head1 OPTIONS
74
75The options to B<llvm-ar> are compatible with other C<ar> implementations.
76However, there are a few modifiers (F<zR>) that are not found in other
77C<ar>s. The options to B<llvm-ar> specify a single basic operation to
78perform on the archive, a variety of modifiers for that operation, the
79name of the archive file, and an optional list of file names. These options
80are used to determine how B<llvm-ar> should process the archive file.
81
82The Operations and Modifiers are explained in the sections below. The minimal
83set of options is at least one operator and the name of the archive. Typically
84archive files end with a C<.a> suffix, but this is not required. Following
85the F<achive-name> comes a list of F<files> that indicate the specific members
86of the archive to operate on. If the F<files> option is not specified, it
87generally means either "none" or "all" members, depending on the operation.
88
89=head2 Operations
90
91=over
92
93=item d
94
95Delete files from the archive. No modifiers are applicable to this operation.
96The F<files> options specify which members should be removed from the
97archive. It is not an error if a specified file does not appear in the archive.
98If no F<files> are specified, the archive is not modified.
99
100=item m[abi]
101
102Move files from one location in the archive to another. The F<a>, F<b>, and
103F<i> modifiers apply to this operation. The F<files> will all be moved
104to the location given by the modifiers. If no modifiers are used, the files
105will be moved to the end of the archive. If no F<files> are specified, the
106archive is not modified.
107
108=item p
109
110Print files to the standard output. No modifiers are applicable to this
111operation. This operation simply prints the F<files> indicated to the
112standard output. If no F<files> are specified, the entire archive is printed.
113Printing bytecode files is ill-advised as they might confuse your terminal
114settings. The F<p> operation never modifies the archive.
115
116=item q[Rfz]
117
118Quickly append files to the end of the archive. The F<R>, F<f>, and F<z>
119modifiers apply to this operation. This operation quickly adds the
120F<files> to the archive without checking for duplicates that shoud be
121removed first. If no F<files> are specified, the archive is not modified.
122Becasue of the way that B<llvm-ar> constructs the archive file, its dubious
123whether the F<q> operation is any faster than the F<r> operation.
124
125=item r[Rabfuz]
126
127Replace or insert file members. The F<R>, F<a>, F<b>, F<f>, F<u>, and F<z>
128modifiers apply to this operation. This operation will replace existing
129F<files> or insert them at the end of the archive if they do not exist. If no
130F<files> are specified, the archive is not modified.
131
132=item t[v]
133
134Print the table of contents. Without any modifiers, this operation just prints
135the names of the members to the standard output. With the F<v> modifier,
136B<llvm-ar> also prints out the file type (B=bytecode, Z=compressed, S=symbol
137table, blank=regular file), the permission mode, the owner and group, the
138size, and the date. If any F<files> are specified, the listing is only for
139those files. If no F<files> are specified, the table of contents for the
140whole archive is printed.
141
142=item x[o]
143
144Extract archive members back to files. The F<o> modifier applies to this
145operation. This operation retrieves the indicated F<files> from the archive
146and writes them back to the operating system's file system. If no
147F<files> are specified, the entire archive is extract.
148
149=back
150
151=head2 Modifiers (operation specific)
152
153=over
154
155=item [a]
156
157put F<files> after [relpos]
158
159=item [b]
160
161put F<files> before [relpos] (same as [i])
162
163=item [f]
164
165truncate inserted file names
166
167=item [i]
168
169put file(s) before [relpos] (same as [b])
170
171=item [N]
172
173use instance [count] of name
174
175=item [o]
176
177preserve original dates
178
179=item [P]
180
181use full path names when matching
182
183=item [R]
184
185recurse through directories when inserting
186
187=item [u]
188
189update only files newer than archive contents
190
191=item [z]
192
193compress/uncompress files before inserting/extracting
194
195=back
196
197=head2 Modifiers (generic)
198
199=over
200
201=item [c]
202
203do not warn if the library had to be created
204
205=item [s]
206
207create an archive index (cf. ranlib)
208
209=item [S]
210
211do not build a symbol table
212
213=item [R]
214
215recursively process directories
216
217=item [v]
218
219be verbose
220
221=back
222
223=head1 EXIT STATUS
224
225If B<llvm-as> succeeds, it will exit with 0. A usage error, results
226in an exit code of 1. A hard (file system typically) error results in an
227exit code of 2. Miscellaneous or unknown errors result in an
228exit code of 3.
229
230=head1 SEE ALSO
231
232L<llvm-ld|llvm-ld>
233
234=head1 AUTHORS
235
236Maintained by the LLVM Team (L<http://llvm.cs.uiuc.edu>).
237
238=cut