]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - usr.bin/clang/llvm-ar/llvm-ar.1
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / usr.bin / clang / llvm-ar / llvm-ar.1
1 .\" $FreeBSD$
2 .\" Man page generated from reStructuredText.
3 .
4 .TH "LLVM-AR" "1" "2014-01-01" "3.4" "LLVM"
5 .SH NAME
6 llvm-ar \- LLVM archiver
7 .
8 .nr rst2man-indent-level 0
9 .
10 .de1 rstReportMargin
11 \\$1 \\n[an-margin]
12 level \\n[rst2man-indent-level]
13 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
14 -
15 \\n[rst2man-indent0]
16 \\n[rst2man-indent1]
17 \\n[rst2man-indent2]
18 ..
19 .de1 INDENT
20 .\" .rstReportMargin pre:
21 . RS \\$1
22 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
23 . nr rst2man-indent-level +1
24 .\" .rstReportMargin post:
25 ..
26 .de UNINDENT
27 . RE
28 .\" indent \\n[an-margin]
29 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
30 .nr rst2man-indent-level -1
31 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
32 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
33 ..
34 .SH SYNOPSIS
35 .sp
36 \fBllvm\-ar\fP [\-]{dmpqrtx}[Rabfikou] [relpos] [count] <archive> [files...]
37 .SH DESCRIPTION
38 .sp
39 The \fBllvm\-ar\fP command is similar to the common Unix utility, \fBar\fP\&. It
40 archives several files together into a single file. The intent for this is
41 to produce archive libraries by LLVM bitcode that can be linked into an
42 LLVM program. However, the archive can contain any kind of file. By default,
43 \fBllvm\-ar\fP generates a symbol table that makes linking faster because
44 only the symbol table needs to be consulted, not each individual file member
45 of the archive.
46 .sp
47 The \fBllvm\-ar\fP command can be used to \fIread\fP SVR4, GNU and BSD style archive
48 files. However, right now it can only write in the GNU format. If an
49 SVR4 or BSD style archive is used with the \fBr\fP (replace) or \fBq\fP (quick
50 update) operations, the archive will be reconstructed in GNU format.
51 .sp
52 Here\(aqs where \fBllvm\-ar\fP departs from previous \fBar\fP implementations:
53 .sp
54 \fISymbol Table\fP
55 .INDENT 0.0
56 .INDENT 3.5
57 Since \fBllvm\-ar\fP supports bitcode files. The symbol table it creates
58 is in GNU format and includes both native and bitcode files.
59 .UNINDENT
60 .UNINDENT
61 .sp
62 \fILong Paths\fP
63 .INDENT 0.0
64 .INDENT 3.5
65 Currently \fBllvm\-ar\fP can read GNU and BSD long file names, but only writes
66 archives with the GNU format.
67 .UNINDENT
68 .UNINDENT
69 .SH OPTIONS
70 .sp
71 The options to \fBllvm\-ar\fP are compatible with other \fBar\fP implementations.
72 However, there are a few modifiers (\fIR\fP) that are not found in other \fBar\fP
73 implementations. The options to \fBllvm\-ar\fP specify a single basic operation to
74 perform on the archive, a variety of modifiers for that operation, the name of
75 the archive file, and an optional list of file names. These options are used to
76 determine how \fBllvm\-ar\fP should process the archive file.
77 .sp
78 The Operations and Modifiers are explained in the sections below. The minimal
79 set of options is at least one operator and the name of the archive. Typically
80 archive files end with a \fB\&.a\fP suffix, but this is not required. Following
81 the \fIarchive\-name\fP comes a list of \fIfiles\fP that indicate the specific members
82 of the archive to operate on. If the \fIfiles\fP option is not specified, it
83 generally means either "none" or "all" members, depending on the operation.
84 .SS Operations
85 .sp
86 d
87 .INDENT 0.0
88 .INDENT 3.5
89 Delete files from the archive. No modifiers are applicable to this operation.
90 The \fIfiles\fP options specify which members should be removed from the
91 archive. It is not an error if a specified file does not appear in the archive.
92 If no \fIfiles\fP are specified, the archive is not modified.
93 .UNINDENT
94 .UNINDENT
95 .sp
96 m[abi]
97 .INDENT 0.0
98 .INDENT 3.5
99 Move files from one location in the archive to another. The \fIa\fP, \fIb\fP, and
100 \fIi\fP modifiers apply to this operation. The \fIfiles\fP will all be moved
101 to the location given by the modifiers. If no modifiers are used, the files
102 will be moved to the end of the archive. If no \fIfiles\fP are specified, the
103 archive is not modified.
104 .UNINDENT
105 .UNINDENT
106 .sp
107 p
108 .INDENT 0.0
109 .INDENT 3.5
110 Print files to the standard output. This operation simply prints the
111 \fIfiles\fP indicated to the standard output. If no \fIfiles\fP are
112 specified, the entire  archive is printed.  Printing bitcode files is
113 ill\-advised as they might confuse your terminal settings. The \fIp\fP
114 operation never modifies the archive.
115 .UNINDENT
116 .UNINDENT
117 .sp
118 q
119 .INDENT 0.0
120 .INDENT 3.5
121 Quickly append files to the end of the archive.  This operation quickly adds the
122 \fIfiles\fP to the archive without checking for duplicates that should be
123 removed first. If no \fIfiles\fP are specified, the archive is not modified.
124 Because of the way that \fBllvm\-ar\fP constructs the archive file, its dubious
125 whether the \fIq\fP operation is any faster than the \fIr\fP operation.
126 .UNINDENT
127 .UNINDENT
128 .sp
129 r[abu]
130 .INDENT 0.0
131 .INDENT 3.5
132 Replace or insert file members. The \fIa\fP, \fIb\fP,  and \fIu\fP
133 modifiers apply to this operation. This operation will replace existing
134 \fIfiles\fP or insert them at the end of the archive if they do not exist. If no
135 \fIfiles\fP are specified, the archive is not modified.
136 .UNINDENT
137 .UNINDENT
138 .sp
139 t[v]
140 .INDENT 0.0
141 .INDENT 3.5
142 Print the table of contents. Without any modifiers, this operation just prints
143 the names of the members to the standard output. With the \fIv\fP modifier,
144 \fBllvm\-ar\fP also prints out the file type (B=bitcode, S=symbol
145 table, blank=regular file), the permission mode, the owner and group, the
146 size, and the date. If any \fIfiles\fP are specified, the listing is only for
147 those files. If no \fIfiles\fP are specified, the table of contents for the
148 whole archive is printed.
149 .UNINDENT
150 .UNINDENT
151 .sp
152 x[oP]
153 .INDENT 0.0
154 .INDENT 3.5
155 Extract archive members back to files. The \fIo\fP modifier applies to this
156 operation. This operation retrieves the indicated \fIfiles\fP from the archive
157 and writes them back to the operating system\(aqs file system. If no
158 \fIfiles\fP are specified, the entire archive is extract.
159 .UNINDENT
160 .UNINDENT
161 .SS Modifiers (operation specific)
162 .sp
163 The modifiers below are specific to certain operations. See the Operations
164 section (above) to determine which modifiers are applicable to which operations.
165 .sp
166 [a]
167 .INDENT 0.0
168 .INDENT 3.5
169 When inserting or moving member files, this option specifies the destination of
170 the new files as being after the \fIrelpos\fP member. If \fIrelpos\fP is not found,
171 the files are placed at the end of the archive.
172 .UNINDENT
173 .UNINDENT
174 .sp
175 [b]
176 .INDENT 0.0
177 .INDENT 3.5
178 When inserting or moving member files, this option specifies the destination of
179 the new files as being before the \fIrelpos\fP member. If \fIrelpos\fP is not
180 found, the files are placed at the end of the archive. This modifier is
181 identical to the \fIi\fP modifier.
182 .UNINDENT
183 .UNINDENT
184 .sp
185 [i]
186 .INDENT 0.0
187 .INDENT 3.5
188 A synonym for the \fIb\fP option.
189 .UNINDENT
190 .UNINDENT
191 .sp
192 [o]
193 .INDENT 0.0
194 .INDENT 3.5
195 When extracting files, this option will cause \fBllvm\-ar\fP to preserve the
196 original modification times of the files it writes.
197 .UNINDENT
198 .UNINDENT
199 .sp
200 [u]
201 .INDENT 0.0
202 .INDENT 3.5
203 When replacing existing files in the archive, only replace those files that have
204 a time stamp than the time stamp of the member in the archive.
205 .UNINDENT
206 .UNINDENT
207 .SS Modifiers (generic)
208 .sp
209 The modifiers below may be applied to any operation.
210 .sp
211 [c]
212 .INDENT 0.0
213 .INDENT 3.5
214 For all operations, \fBllvm\-ar\fP will always create the archive if it doesn\(aqt
215 exist. Normally, \fBllvm\-ar\fP will print a warning message indicating that the
216 archive is being created. Using this modifier turns off that warning.
217 .UNINDENT
218 .UNINDENT
219 .sp
220 [s]
221 .INDENT 0.0
222 .INDENT 3.5
223 This modifier requests that an archive index (or symbol table) be added to the
224 archive. This is the default mode of operation. The symbol table will contain
225 all the externally visible functions and global variables defined by all the
226 bitcode files in the archive.
227 .UNINDENT
228 .UNINDENT
229 .sp
230 [S]
231 .INDENT 0.0
232 .INDENT 3.5
233 This modifier is the opposite of the \fIs\fP modifier. It instructs \fBllvm\-ar\fP to
234 not build the symbol table. If both \fIs\fP and \fIS\fP are used, the last modifier to
235 occur in the options will prevail.
236 .UNINDENT
237 .UNINDENT
238 .sp
239 [v]
240 .INDENT 0.0
241 .INDENT 3.5
242 This modifier instructs \fBllvm\-ar\fP to be verbose about what it is doing. Each
243 editing operation taken against the archive will produce a line of output saying
244 what is being done.
245 .UNINDENT
246 .UNINDENT
247 .SH STANDARDS
248 .sp
249 The \fBllvm\-ar\fP utility is intended to provide a superset of the IEEE Std 1003.2
250 (POSIX.2) functionality for \fBar\fP\&. \fBllvm\-ar\fP can read both SVR4 and BSD4.4 (or
251 Mac OS X) archives. If the \fBf\fP modifier is given to the \fBx\fP or \fBr\fP operations
252 then \fBllvm\-ar\fP will write SVR4 compatible archives. Without this modifier,
253 \fBllvm\-ar\fP will write BSD4.4 compatible archives that have long names
254 immediately after the header and indicated using the "#1/ddd" notation for the
255 name in the header.
256 .SH FILE FORMAT
257 .sp
258 The file format for LLVM Archive files is similar to that of BSD 4.4 or Mac OSX
259 archive files. In fact, except for the symbol table, the \fBar\fP commands on those
260 operating systems should be able to read LLVM archive files. The details of the
261 file format follow.
262 .sp
263 Each archive begins with the archive magic number which is the eight printable
264 characters "!<arch>n" where n represents the newline character (0x0A).
265 Following the magic number, the file is composed of even length members that
266 begin with an archive header and end with a n padding character if necessary
267 (to make the length even). Each file member is composed of a header (defined
268 below), an optional newline\-terminated "long file name" and the contents of
269 the file.
270 .sp
271 The fields of the header are described in the items below. All fields of the
272 header contain only ASCII characters, are left justified and are right padded
273 with space characters.
274 .sp
275 name \- char[16]
276 .INDENT 0.0
277 .INDENT 3.5
278 This field of the header provides the name of the archive member. If the name is
279 longer than 15 characters or contains a slash (/) character, then this field
280 contains \fB#1/nnn\fP where \fBnnn\fP provides the length of the name and the \fB#1/\fP
281 is literal.  In this case, the actual name of the file is provided in the \fBnnn\fP
282 bytes immediately following the header. If the name is 15 characters or less, it
283 is contained directly in this field and terminated with a slash (/) character.
284 .UNINDENT
285 .UNINDENT
286 .sp
287 date \- char[12]
288 .INDENT 0.0
289 .INDENT 3.5
290 This field provides the date of modification of the file in the form of a
291 decimal encoded number that provides the number of seconds since the epoch
292 (since 00:00:00 Jan 1, 1970) per Posix specifications.
293 .UNINDENT
294 .UNINDENT
295 .sp
296 uid \- char[6]
297 .INDENT 0.0
298 .INDENT 3.5
299 This field provides the user id of the file encoded as a decimal ASCII string.
300 This field might not make much sense on non\-Unix systems. On Unix, it is the
301 same value as the st_uid field of the stat structure returned by the stat(2)
302 operating system call.
303 .UNINDENT
304 .UNINDENT
305 .sp
306 gid \- char[6]
307 .INDENT 0.0
308 .INDENT 3.5
309 This field provides the group id of the file encoded as a decimal ASCII string.
310 This field might not make much sense on non\-Unix systems. On Unix, it is the
311 same value as the st_gid field of the stat structure returned by the stat(2)
312 operating system call.
313 .UNINDENT
314 .UNINDENT
315 .sp
316 mode \- char[8]
317 .INDENT 0.0
318 .INDENT 3.5
319 This field provides the access mode of the file encoded as an octal ASCII
320 string. This field might not make much sense on non\-Unix systems. On Unix, it
321 is the same value as the st_mode field of the stat structure returned by the
322 stat(2) operating system call.
323 .UNINDENT
324 .UNINDENT
325 .sp
326 size \- char[10]
327 .INDENT 0.0
328 .INDENT 3.5
329 This field provides the size of the file, in bytes, encoded as a decimal ASCII
330 string.
331 .UNINDENT
332 .UNINDENT
333 .sp
334 fmag \- char[2]
335 .INDENT 0.0
336 .INDENT 3.5
337 This field is the archive file member magic number. Its content is always the
338 two characters back tick (0x60) and newline (0x0A). This provides some measure
339 utility in identifying archive files that have been corrupted.
340 .UNINDENT
341 .UNINDENT
342 .sp
343 offset \- vbr encoded 32\-bit integer
344 .INDENT 0.0
345 .INDENT 3.5
346 The offset item provides the offset into the archive file where the bitcode
347 member is stored that is associated with the symbol. The offset value is 0
348 based at the start of the first "normal" file member. To derive the actual
349 file offset of the member, you must add the number of bytes occupied by the file
350 signature (8 bytes) and the symbol tables. The value of this item is encoded
351 using variable bit rate encoding to reduce the size of the symbol table.
352 Variable bit rate encoding uses the high bit (0x80) of each byte to indicate
353 if there are more bytes to follow. The remaining 7 bits in each byte carry bits
354 from the value. The final byte does not have the high bit set.
355 .UNINDENT
356 .UNINDENT
357 .sp
358 length \- vbr encoded 32\-bit integer
359 .INDENT 0.0
360 .INDENT 3.5
361 The length item provides the length of the symbol that follows. Like this
362 \fIoffset\fP item, the length is variable bit rate encoded.
363 .UNINDENT
364 .UNINDENT
365 .sp
366 symbol \- character array
367 .INDENT 0.0
368 .INDENT 3.5
369 The symbol item provides the text of the symbol that is associated with the
370 \fIoffset\fP\&. The symbol is not terminated by any character. Its length is provided
371 by the \fIlength\fP field. Note that is allowed (but unwise) to use non\-printing
372 characters (even 0x00) in the symbol. This allows for multiple encodings of
373 symbol names.
374 .UNINDENT
375 .UNINDENT
376 .SH EXIT STATUS
377 .sp
378 If \fBllvm\-ar\fP succeeds, it will exit with 0.  A usage error, results
379 in an exit code of 1. A hard (file system typically) error results in an
380 exit code of 2. Miscellaneous or unknown errors result in an
381 exit code of 3.
382 .SH SEE ALSO
383 .sp
384 ar(1)
385 .SH AUTHOR
386 Maintained by The LLVM Team (http://llvm.org/).
387 .SH COPYRIGHT
388 2003-2013, LLVM Project
389 .\" Generated by docutils manpage writer.
390 .