blob: a624f46f9cd261e271c8bb367a31b661a2c76ced [file] [log] [blame]
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.if t .Sp
.ne 5
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
.de Vb \" Begin verbatim text
.ft CW
.ne \\$1
.de Ve \" End verbatim text
.ft R
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
. nr % 0
. rr F
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.rm #[ #] #H #V #F C
.\" ========================================================================
.IX Title "LLVM-AR 1"
.TH LLVM-AR 1 "2006-11-20" "CVS" "LLVM Command Guide"
llvm\-ar \- LLVM archiver
\&\fBllvm-ar\fR [\-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...]
The \fBllvm-ar\fR command is similar to the common Unix utility, \f(CW\*(C`ar\*(C'\fR. It
archives several files together into a single file. The intent for this is
to produce archive libraries by \s-1LLVM\s0 bytecode that can be linked into an
\&\s-1LLVM\s0 program. However, the archive can contain any kind of file. By default,
\&\fBllvm-ar\fR generates a symbol table that makes linking faster because
only the symbol table needs to be consulted, not each individual file member
of the archive.
The \fBllvm-ar\fR command can be used to \fIread\fR both \s-1SVR4\s0 and \s-1BSD\s0 style archive
files. However, it cannot be used to write them. While the \fBllvm-ar\fR command
produces files that are \fIalmost\fR identical to the format used by other \f(CW\*(C`ar\*(C'\fR
implementations, it has two significant departures in order to make the
archive appropriate for \s-1LLVM\s0. The first departure is that \fBllvm-ar\fR only
uses \s-1BSD4\s0.4 style long path names (stored immediately after the header) and
never contains a string table for long names. The second departure is that the
symbol table is formated for efficient construction of an in-memory data
structure that permits rapid (red\-black tree) lookups. Consequently, archives
produced with \fBllvm-ar\fR usually won't be readable or editable with any
\&\f(CW\*(C`ar\*(C'\fR implementation or useful for linking. Using the \f(CW\*(C`f\*(C'\fR modifier to flatten
file names will make the archive readable by other \f(CW\*(C`ar\*(C'\fR implementations
but not for linking because the symbol table format for \s-1LLVM\s0 is unique. If an
\&\s-1SVR4\s0 or \s-1BSD\s0 style archive is used with the \f(CW\*(C`r\*(C'\fR (replace) or \f(CW\*(C`q\*(C'\fR (quick
update) operations, the archive will be reconstructed in \s-1LLVM\s0 format. This
means that the string table will be dropped (in deference to \s-1BSD\s0 4.4 long names)
and an \s-1LLVM\s0 symbol table will be added (by default). The system symbol table
will be retained.
Here's where \fBllvm-ar\fR departs from previous \f(CW\*(C`ar\*(C'\fR implementations:
.IP "\fISymbol Table\fR" 4
.IX Item "Symbol Table"
Since \fBllvm-ar\fR is intended to archive bytecode files, the symbol table
won't make much sense to anything but \s-1LLVM\s0. Consequently, the symbol table's
format has been simplified. It consists simply of a sequence of pairs
of a file member index number as an \s-1LSB\s0 4byte integer and a null-terminated
.IP "\fILong Paths\fR" 4
.IX Item "Long Paths"
Some \f(CW\*(C`ar\*(C'\fR implementations (\s-1SVR4\s0) use a separate file member to record long
path names (> 15 characters). \fBllvm-ar\fR takes the \s-1BSD\s0 4.4 and Mac \s-1OS\s0 X
approach which is to simply store the full path name immediately preceding
the data for the file. The path name is null terminated and may contain the
slash (/) character.
.IP "\fICompression\fR" 4
.IX Item "Compression"
\&\fBllvm-ar\fR can compress the members of an archive to save space. The
compression used depends on what's available on the platform and what choices
the \s-1LLVM\s0 Compressor utility makes. It generally favors bzip2 but will select
between \*(L"no compression\*(R" or bzip2 depending on what makes sense for the
file's content.
.IP "\fIDirectory Recursion\fR" 4
.IX Item "Directory Recursion"
Most \f(CW\*(C`ar\*(C'\fR implementations do not recurse through directories but simply
ignore directories if they are presented to the program in the \fIfiles\fR
option. \fBllvm-ar\fR, however, can recurse through directory structures and
add all the files under a directory, if requested.
.IP "\fI\s-1TOC\s0 Verbose Output\fR" 4
.IX Item "TOC Verbose Output"
When \fBllvm-ar\fR prints out the verbose table of contents (\f(CW\*(C`tv\*(C'\fR option), it
precedes the usual output with a character indicating the basic kind of
content in the file. A blank means the file is a regular file. A 'Z' means
the file is compressed. A 'B' means the file is an \s-1LLVM\s0 bytecode file. An
\&'S' means the file is the symbol table.
.IX Header "OPTIONS"
The options to \fBllvm-ar\fR are compatible with other \f(CW\*(C`ar\*(C'\fR implementations.
However, there are a few modifiers (\fIzR\fR) that are not found in other
\&\f(CW\*(C`ar\*(C'\fRs. The options to \fBllvm-ar\fR specify a single basic operation to
perform on the archive, a variety of modifiers for that operation, the
name of the archive file, and an optional list of file names. These options
are used to determine how \fBllvm-ar\fR should process the archive file.
The Operations and Modifiers are explained in the sections below. The minimal
set of options is at least one operator and the name of the archive. Typically
archive files end with a \f(CW\*(C`.a\*(C'\fR suffix, but this is not required. Following
the \fIarchive-name\fR comes a list of \fIfiles\fR that indicate the specific members
of the archive to operate on. If the \fIfiles\fR option is not specified, it
generally means either \*(L"none\*(R" or \*(L"all\*(R" members, depending on the operation.
.Sh "Operations"
.IX Subsection "Operations"
.IP "d" 4
.IX Item "d"
Delete files from the archive. No modifiers are applicable to this operation.
The \fIfiles\fR options specify which members should be removed from the
archive. It is not an error if a specified file does not appear in the archive.
If no \fIfiles\fR are specified, the archive is not modified.
.IP "m[abi]" 4
.IX Item "m[abi]"
Move files from one location in the archive to another. The \fIa\fR, \fIb\fR, and
\&\fIi\fR modifiers apply to this operation. The \fIfiles\fR will all be moved
to the location given by the modifiers. If no modifiers are used, the files
will be moved to the end of the archive. If no \fIfiles\fR are specified, the
archive is not modified.
.IP "p[k]" 4
.IX Item "p[k]"
Print files to the standard output. The \fIk\fR modifier applies to this
operation. This operation simply prints the \fIfiles\fR indicated to the
standard output. If no \fIfiles\fR are specified, the entire archive is printed.
Printing bytecode files is ill-advised as they might confuse your terminal
settings. The \fIp\fR operation never modifies the archive.
.IP "q[Rfz]" 4
.IX Item "q[Rfz]"
Quickly append files to the end of the archive. The \fIR\fR, \fIf\fR, and \fIz\fR
modifiers apply to this operation. This operation quickly adds the
\&\fIfiles\fR to the archive without checking for duplicates that should be
removed first. If no \fIfiles\fR are specified, the archive is not modified.
Because of the way that \fBllvm-ar\fR constructs the archive file, its dubious
whether the \fIq\fR operation is any faster than the \fIr\fR operation.
.IP "r[Rabfuz]" 4
.IX Item "r[Rabfuz]"
Replace or insert file members. The \fIR\fR, \fIa\fR, \fIb\fR, \fIf\fR, \fIu\fR, and \fIz\fR
modifiers apply to this operation. This operation will replace existing
\&\fIfiles\fR or insert them at the end of the archive if they do not exist. If no
\&\fIfiles\fR are specified, the archive is not modified.
.IP "t[v]" 4
.IX Item "t[v]"
Print the table of contents. Without any modifiers, this operation just prints
the names of the members to the standard output. With the \fIv\fR modifier,
\&\fBllvm-ar\fR also prints out the file type (B=bytecode, Z=compressed, S=symbol
table, blank=regular file), the permission mode, the owner and group, the
size, and the date. If any \fIfiles\fR are specified, the listing is only for
those files. If no \fIfiles\fR are specified, the table of contents for the
whole archive is printed.
.IP "x[oP]" 4
.IX Item "x[oP]"
Extract archive members back to files. The \fIo\fR modifier applies to this
operation. This operation retrieves the indicated \fIfiles\fR from the archive
and writes them back to the operating system's file system. If no
\&\fIfiles\fR are specified, the entire archive is extract.
.Sh "Modifiers (operation specific)"
.IX Subsection "Modifiers (operation specific)"
The modifiers below are specific to certain operations. See the Operations
section (above) to determine which modifiers are applicable to which operations.
.IP "[a]" 4
.IX Item "[a]"
When inserting or moving member files, this option specifies the destination of
the new files as being \f(CW\*(C`a\*(C'\fRfter the \fIrelpos\fR member. If \fIrelpos\fR is not found,
the files are placed at the end of the archive.
.IP "[b]" 4
.IX Item "[b]"
When inserting or moving member files, this option specifies the destination of
the new files as being \f(CW\*(C`b\*(C'\fRefore the \fIrelpos\fR member. If \fIrelpos\fR is not
found, the files are placed at the end of the archive. This modifier is
identical to the the \fIi\fR modifier.
.IP "[f]" 4
.IX Item "[f]"
Normally, \fBllvm-ar\fR stores the full path name to a file as presented to it on
the command line. With this option, truncated (15 characters max) names are
used. This ensures name compatibility with older versions of \f(CW\*(C`ar\*(C'\fR but may also
thwart correct extraction of the files (duplicates may overwrite). If used with
the \fIR\fR option, the directory recursion will be performed but the file names
will all be \f(CW\*(C`f\*(C'\fRlattened to simple file names.
.IP "[i]" 4
.IX Item "[i]"
A synonym for the \fIb\fR option.
.IP "[k]" 4
.IX Item "[k]"
Normally, \fBllvm-ar\fR will not print the contents of bytecode files when the
\&\fIp\fR operation is used. This modifier defeats the default and allows the
bytecode members to be printed.
.IP "[N]" 4
.IX Item "[N]"
This option is ignored by \fBllvm-ar\fR but provided for compatibility.
.IP "[o]" 4
.IX Item "[o]"
When extracting files, this option will cause \fBllvm-ar\fR to preserve the
original modification times of the files it writes.
.IP "[P]" 4
.IX Item "[P]"
use full path names when matching
.IP "[R]" 4
.IX Item "[R]"
This modifier instructions the \fIr\fR option to recursively process directories.
Without \fIR\fR, directories are ignored and only those \fIfiles\fR that refer to
files will be added to the archive. When \fIR\fR is used, any directories specified
with \fIfiles\fR will be scanned (recursively) to find files to be added to the
archive. Any file whose name begins with a dot will not be added.
.IP "[u]" 4
.IX Item "[u]"
When replacing existing files in the archive, only replace those files that have
a time stamp than the time stamp of the member in the archive.
.IP "[z]" 4
.IX Item "[z]"
When inserting or replacing any file in the archive, compress the file first.
modifier is safe to use when (previously) compressed bytecode files are added to
the archive; the compressed bytecode files will not be doubly compressed.
.Sh "Modifiers (generic)"
.IX Subsection "Modifiers (generic)"
The modifiers below may be applied to any operation.
.IP "[c]" 4
.IX Item "[c]"
For all operations, \fBllvm-ar\fR will always create the archive if it doesn't
exist. Normally, \fBllvm-ar\fR will print a warning message indicating that the
archive is being created. Using this modifier turns off that warning.
.IP "[s]" 4
.IX Item "[s]"
This modifier requests that an archive index (or symbol table) be added to the
archive. This is the default mode of operation. The symbol table will contain
all the externally visible functions and global variables defined by all the
bytecode files in the archive. Using this modifier is more efficient that using
llvm-ranlib which also creates the symbol table.
.IP "[S]" 4
.IX Item "[S]"
This modifier is the opposite of the \fIs\fR modifier. It instructs \fBllvm-ar\fR to
not build the symbol table. If both \fIs\fR and \fIS\fR are used, the last modifier to
occur in the options will prevail.
.IP "[v]" 4
.IX Item "[v]"
This modifier instructs \fBllvm-ar\fR to be verbose about what it is doing. Each
editing operation taken against the archive will produce a line of output saying
what is being done.
The \fBllvm-ar\fR utility is intended to provide a superset of the \s-1IEEE\s0 Std 1003.2
(\s-1POSIX\s0.2) functionality for \f(CW\*(C`ar\*(C'\fR. \fBllvm-ar\fR can read both \s-1SVR4\s0 and \s-1BSD4\s0.4 (or
Mac \s-1OS\s0 X) archives. If the \f(CW\*(C`f\*(C'\fR modifier is given to the \f(CW\*(C`x\*(C'\fR or \f(CW\*(C`r\*(C'\fR operations
then \fBllvm-ar\fR will write \s-1SVR4\s0 compatible archives. Without this modifier,
\&\fBllvm-ar\fR will write \s-1BSD4\s0.4 compatible archives that have long names
immediately after the header and indicated using the \*(L"#1/ddd\*(R" notation for the
name in the header.
The file format for \s-1LLVM\s0 Archive files is similar to that of \s-1BSD\s0 4.4 or Mac \s-1OSX\s0
archive files. In fact, except for the symbol table, the \f(CW\*(C`ar\*(C'\fR commands on those
operating systems should be able to read \s-1LLVM\s0 archive files. The details of the
file format follow.
Each archive begins with the archive magic number which is the eight printable
characters \*(L"!<arch>\en\*(R" where \en represents the newline character (0x0A).
Following the magic number, the file is composed of even length members that
begin with an archive header and end with a \en padding character if necessary
(to make the length even). Each file member is composed of a header (defined
below), an optional newline-terminated \*(L"long file name\*(R" and the contents of
the file.
The fields of the header are described in the items below. All fields of the
header contain only \s-1ASCII\s0 characters, are left justified and are right padded
with space characters.
.IP "name \- char[16]" 4
.IX Item "name - char[16]"
This field of the header provides the name of the archive member. If the name is
longer than 15 characters or contains a slash (/) character, then this field
contains \f(CW\*(C`#1/nnn\*(C'\fR where \f(CW\*(C`nnn\*(C'\fR provides the length of the name and the \f(CW\*(C`#1/\*(C'\fR
is literal. In this case, the actual name of the file is provided in the \f(CW\*(C`nnn\*(C'\fR
bytes immediately following the header. If the name is 15 characters or less, it
is contained directly in this field and terminated with a slash (/) character.
.IP "date \- char[12]" 4
.IX Item "date - char[12]"
This field provides the date of modification of the file in the form of a
decimal encoded number that provides the number of seconds since the epoch
(since 00:00:00 Jan 1, 1970) per Posix specifications.
.IP "uid \- char[6]" 4
.IX Item "uid - char[6]"
This field provides the user id of the file encoded as a decimal \s-1ASCII\s0 string.
This field might not make much sense on non-Unix systems. On Unix, it is the
same value as the st_uid field of the stat structure returned by the \fIstat\fR\|(2)
operating system call.
.IP "gid \- char[6]" 4
.IX Item "gid - char[6]"
This field provides the group id of the file encoded as a decimal \s-1ASCII\s0 string.
This field might not make much sense on non-Unix systems. On Unix, it is the
same value as the st_gid field of the stat structure returned by the \fIstat\fR\|(2)
operating system call.
.IP "mode \- char[8]" 4
.IX Item "mode - char[8]"
This field provides the access mode of the file encoded as an octal \s-1ASCII\s0
string. This field might not make much sense on non-Unix systems. On Unix, it
is the same value as the st_mode field of the stat structure returned by the
\&\fIstat\fR\|(2) operating system call.
.IP "size \- char[10]" 4
.IX Item "size - char[10]"
This field provides the size of the file, in bytes, encoded as a decimal \s-1ASCII\s0
string. If the size field is negative (starts with a minus sign, 0x02D), then
the archive member is stored in compressed form. The first byte of the archive
member's data indicates the compression type used. A value of 0 (0x30) indicates
that no compression was used. A value of 2 (0x32) indicates that bzip2
compression was used.
.IP "fmag \- char[2]" 4
.IX Item "fmag - char[2]"
This field is the archive file member magic number. Its content is always the
two characters back tick (0x60) and newline (0x0A). This provides some measure
utility in identifying archive files that have been corrupted.
The \s-1LLVM\s0 symbol table has the special name \*(L"#_LLVM_SYM_TAB_#\*(R". It is presumed
that no regular archive member file will want this name. The \s-1LLVM\s0 symbol table
is simply composed of a sequence of triplets: byte offset, length of symbol,
and the symbol itself. Symbols are not null or newline terminated. Here are
the details on each of these items:
.IP "offset \- vbr encoded 32\-bit integer" 4
.IX Item "offset - vbr encoded 32-bit integer"
The offset item provides the offset into the archive file where the bytecode
member is stored that is associated with the symbol. The offset value is 0
based at the start of the first \*(L"normal\*(R" file member. To derive the actual
file offset of the member, you must add the number of bytes occupied by the file
signature (8 bytes) and the symbol tables. The value of this item is encoded
using variable bit rate encoding to reduce the size of the symbol table.
Variable bit rate encoding uses the high bit (0x80) of each byte to indicate
if there are more bytes to follow. The remaining 7 bits in each byte carry bits
from the value. The final byte does not have the high bit set.
.IP "length \- vbr encoded 32\-bit integer" 4
.IX Item "length - vbr encoded 32-bit integer"
The length item provides the length of the symbol that follows. Like this
\&\fIoffset\fR item, the length is variable bit rate encoded.
.IP "symbol \- character array" 4
.IX Item "symbol - character array"
The symbol item provides the text of the symbol that is associated with the
\&\fIoffset\fR. The symbol is not terminated by any character. Its length is provided
by the \fIlength\fR field. Note that is allowed (but unwise) to use non-printing
characters (even 0x00) in the symbol. This allows for multiple encodings of
symbol names.
If \fBllvm-ar\fR succeeds, it will exit with 0. A usage error, results
in an exit code of 1. A hard (file system typically) error results in an
exit code of 2. Miscellaneous or unknown errors result in an
exit code of 3.
.IX Header "SEE ALSO"
llvm-ranlib, \fIar\fR\|(1)
.IX Header "AUTHORS"
Maintained by the \s-1LLVM\s0 Team (<>).