2012-05-09 00:50:35 +08:00
|
|
|
llvm-ar - LLVM archiver
|
|
|
|
=======================
|
|
|
|
|
[docs][tools] Add missing "program" tags to rst files
Sphinx allows for definitions of command-line options using
`.. option <name>` and references to those options via `:option:<name>`.
However, it looks like there is no scoping of these options by default,
meaning that links can end up pointing to incorrect documents. See for
example the llvm-mca document, which contains references to -o that,
prior to this patch, pointed to a different document. What's worse is
that these links appear to be non-deterministic in which one is picked
(on my machine, some references end up pointing to opt, whereas on the
live docs, they point to llvm-dwarfdump, for example).
The fix is to add the .. program <name> tag. This essentially namespaces
the options (definitions and references) to the named program, ensuring
that the links are kept correct.
Reviwed by: andreadb
Differential Revision: https://reviews.llvm.org/D63873
llvm-svn: 364538
2019-06-27 21:24:46 +08:00
|
|
|
.. program:: llvm-ar
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
:program:`llvm-ar` [-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive [files...]
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
The :program:`llvm-ar` command is similar to the common Unix utility,
|
|
|
|
:program:`ar`. It archives several files, such as objects and LLVM bitcode
|
|
|
|
files into a single archive library that can be linked into a program. However,
|
|
|
|
the archive can contain any kind of file. By default, :program:`llvm-ar`
|
|
|
|
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.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
The :program:`llvm-ar` command can be used to *read* archive files in SVR4,
|
|
|
|
GNU, BSD and Darwin format, and *write* in the GNU, BSD, and Darwin style
|
|
|
|
archive files. If an SVR4 format archive is used with the :option:`r`
|
|
|
|
(replace), :option:`d` (delete), :option:`m` (move) or :option:`q`
|
|
|
|
(quick update) operations, the archive will be reconstructed in the format
|
|
|
|
defined by :option:`--format`.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Here's where :program:`llvm-ar` departs from previous :program:`ar`
|
|
|
|
implementations:
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
*The following option is not supported*
|
|
|
|
|
|
|
|
[f] - truncate inserted filenames
|
|
|
|
|
|
|
|
*The following options are ignored for compatibility*
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
--plugin=<string> - load a plugin which adds support for other file formats
|
|
|
|
|
|
|
|
[l] - ignored in :program:`ar`
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
*Symbol Table*
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Since :program:`llvm-ar` supports bitcode files, the symbol table it creates
|
|
|
|
includes both native and bitcode symbols.
|
|
|
|
|
|
|
|
*Deterministic Archives*
|
|
|
|
|
|
|
|
By default, :program:`llvm-ar` always uses zero for timestamps and UIDs/GIDs
|
|
|
|
to write archives in a deterministic mode. This is equivalent to the
|
|
|
|
:option:`D` modifier being enabled by default. If you wish to maintain
|
|
|
|
compatibility with other :program:`ar` implementations, you can pass the
|
|
|
|
:option:`U` modifier to write actual timestamps and UIDs/GIDs.
|
2019-10-16 22:07:57 +08:00
|
|
|
|
|
|
|
*Windows Paths*
|
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
When on Windows :program:`llvm-ar` treats the names of archived *files* in the same
|
2019-10-16 22:07:57 +08:00
|
|
|
case sensitive manner as the operating system. When on a non-Windows machine
|
2019-10-21 21:13:31 +08:00
|
|
|
:program:`llvm-ar` does not consider character case.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
OPTIONS
|
|
|
|
-------
|
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
:program:`llvm-ar` operations are compatible with other :program:`ar`
|
|
|
|
implementations. However, there are a few modifiers (:option:`L`) that are not
|
|
|
|
found in other :program:`ar` implementations. The options for
|
|
|
|
:program:`llvm-ar` 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. If the *files* option is not specified, it
|
|
|
|
generally means either "none" or "all" members, depending on the operation. The
|
|
|
|
Options, Operations and Modifiers are explained in the sections below.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
The minimal set of options is at least one operator and the name of the
|
|
|
|
archive.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Operations
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: d [NT]
|
|
|
|
|
|
|
|
Delete files from the ``archive``. The :option:`N` and :option:`T` modifiers
|
|
|
|
apply to this operation. The *files* 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 *files* are specified, the archive is not
|
|
|
|
modified.
|
|
|
|
|
|
|
|
.. option:: m [abi]
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Move files from one location in the ``archive`` to another. The :option:`a`,
|
|
|
|
:option:`b`, and :option:`i` modifiers apply to this operation. The *files*
|
|
|
|
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 *files* are
|
|
|
|
specified, the archive is not modified.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: p [v]
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Print *files* to the standard output stream. If no *files* are specified, the
|
|
|
|
entire ``archive`` is printed. With the :option:`v` modifier,
|
|
|
|
:program:`llvm-ar` also prints out the name of the file being output. Printing
|
|
|
|
binary files is ill-advised as they might confuse your terminal settings. The
|
|
|
|
:option:`p` operation never modifies the archive.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: q [LT]
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Quickly append files to the end of the ``archive`` without removing
|
|
|
|
duplicates. If no *files* are specified, the archive is not modified. The
|
|
|
|
behavior when appending one archive to another depends upon whether the
|
|
|
|
:option:`L` and :option:`T` modifiers are used:
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
* Appending a regular archive to a regular archive will append the archive
|
|
|
|
file. If the :option:`L` modifier is specified the members will be appended
|
|
|
|
instead.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
* Appending a regular archive to a thin archive requires the :option:`T`
|
|
|
|
modifier and will append the archive file. The :option:`L` modifier is not
|
|
|
|
supported.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
* Appending a thin archive to a regular archive will append the archive file.
|
|
|
|
If the :option:`L` modifier is specified the members will be appended
|
|
|
|
instead.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
* Appending a thin archive to a thin archive will always quick append its
|
|
|
|
members.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: r [abTu]
|
|
|
|
|
|
|
|
Replace existing *files* or insert them at the end of the ``archive`` if
|
|
|
|
they do not exist. The :option:`a`, :option:`b`, :option:`T` and :option:`u`
|
|
|
|
modifiers apply to this operation. If no *files* are specified, the archive
|
|
|
|
is not modified.
|
|
|
|
|
|
|
|
t[v]
|
|
|
|
.. option:: t [vO]
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Print the table of contents. Without any modifiers, this operation just prints
|
2019-10-21 21:13:31 +08:00
|
|
|
the names of the members to the standard output stream. With the :option:`v`
|
|
|
|
modifier, :program:`llvm-ar` also prints out the file type (B=bitcode,
|
|
|
|
S=symbol table, blank=regular file), the permission mode, the owner and group,
|
|
|
|
are ignored when extracting *files* and set to placeholder values when adding
|
|
|
|
size, and the date. With the :option:`O` modifier, display member offsets. If
|
|
|
|
any *files* are specified, the listing is only for those files. If no *files*
|
|
|
|
are specified, the table of contents for the whole archive is printed.
|
|
|
|
|
|
|
|
.. option:: V
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
A synonym for the :option:`--version` option.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: x [oP]
|
|
|
|
|
|
|
|
Extract ``archive`` members back to files. The :option:`o` modifier applies
|
|
|
|
to this operation. This operation retrieves the indicated *files* from the
|
|
|
|
archive and writes them back to the operating system's file system. If no
|
|
|
|
*files* are specified, the entire archive is extracted.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Modifiers (operation specific)
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
The modifiers below are specific to certain operations. See the Operations
|
2019-10-21 21:13:31 +08:00
|
|
|
section to determine which modifiers are applicable to which operations.
|
|
|
|
|
|
|
|
.. option:: a
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
When inserting or moving member files, this option specifies the destination
|
|
|
|
of the new files as being after the *relpos* member. If *relpos* is not found,
|
|
|
|
the files are placed at the end of the ``archive``. *relpos* cannot be
|
|
|
|
consumed without either :option:`a`, :option:`b` or :option:`i`.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: b
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
When inserting or moving member files, this option specifies the destination
|
|
|
|
of the new files as being before the *relpos* member. If *relpos* is not
|
|
|
|
found, the files are placed at the end of the ``archive``. *relpos* cannot
|
|
|
|
be consumed without either :option:`a`, :option:`b` or :option:`i`. This
|
|
|
|
modifier is identical to the :option:`i` modifier.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: i
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
A synonym for the :option:`b` option.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: L
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
When quick appending an ``archive``, instead quick append its members. This
|
|
|
|
is a feature for :program:`llvm-ar` that is not found in gnu-ar.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: N
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
When extracting or deleting a member that shares its name with another member,
|
|
|
|
the *count* parameter allows you to supply a positive whole number that
|
|
|
|
selects the instance of the given name, with "1" indicating the first
|
|
|
|
instance. If :option:`N` is not specified the first member of that name will
|
|
|
|
be selected. If *count* is not supplied, the operation fails.*count* cannot be
|
|
|
|
|
|
|
|
.. option:: o
|
|
|
|
|
|
|
|
When extracting files, use the modification times of any *files* as they
|
|
|
|
appear in the ``archive``. By default *files* extracted from the archive
|
|
|
|
use the time of extraction.
|
|
|
|
|
2019-10-17 19:56:26 +08:00
|
|
|
.. option:: O
|
2019-10-17 19:34:29 +08:00
|
|
|
|
|
|
|
Display member offsets inside the archive.
|
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: T
|
|
|
|
|
|
|
|
When creating or modifying an archive, this option specifies that the
|
|
|
|
``archive`` will be thin. By default, archives are not created as thin
|
|
|
|
archives and when modifying a thin archive, it will be converted to a regular
|
|
|
|
archive.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: v
|
|
|
|
|
|
|
|
When printing *files* or the ``archive`` table of contents, this modifier
|
|
|
|
instructs :program:`llvm-ar` to include additional information in the output.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
Modifiers (generic)
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
The modifiers below may be applied to any operation.
|
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: c
|
|
|
|
|
|
|
|
For the :option:`r` (replace)and :option:`q` (quick update) operations,
|
|
|
|
:program:`llvm-ar` will always create the archive if it doesn't exist.
|
|
|
|
Normally, :program:`llvm-ar` will print a warning message indicating that the
|
|
|
|
``archive`` is being created. Using this modifier turns off
|
|
|
|
that warning.
|
|
|
|
|
|
|
|
.. option:: D
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Use zero for timestamps and UIDs/GIDs. This is set by default.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: P
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Use full paths when matching member names rather than just the file name.
|
|
|
|
This can be useful when manipulating an ``archive`` generated by another
|
|
|
|
archiver, as some allow paths as member names. This is the default behavior
|
|
|
|
for thin archives.
|
|
|
|
|
|
|
|
.. option:: s
|
2012-05-09 00:50:35 +08:00
|
|
|
|
|
|
|
This modifier requests that an archive index (or symbol table) be added to the
|
2019-10-21 21:13:31 +08:00
|
|
|
``archive``, as if using ranlib. The symbol table will contain all the
|
|
|
|
externally visible functions and global variables defined by all the bitcode
|
|
|
|
files in the archive. By default :program:`llvm-ar` generates symbol tables in
|
|
|
|
archives. This can also be used as an operation.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: S
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
This modifier is the opposite of the :option:`s` modifier. It instructs
|
|
|
|
:program:`llvm-ar` to not build the symbol table. If both :option:`s` and
|
|
|
|
:option:`S` are used, the last modifier to occur in the options will prevail.
|
|
|
|
|
|
|
|
.. option:: u
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Only update ``archive`` members with *files* that have more recent
|
|
|
|
timestamps.
|
|
|
|
|
|
|
|
.. option:: U
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Use actual timestamps and UIDs/GIDs.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Other
|
|
|
|
~~~~~
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: --format=<type>
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
This option allows for default, gnu, darwin or bsd ``<type>`` to be selected.
|
|
|
|
When creating an ``archive``, ``<type>`` will default to that of the host
|
|
|
|
machine.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: -h, --help
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Print a summary of command-line options and their meanings.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: -M
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
This option allows for MRI scripts to be read through the standard input
|
|
|
|
stream. No other options are compatible with this option.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: --version
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Display the version of the :program:`llvm-ar` executable.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: @<FILE>
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Read command-line options and commands from response file ``<FILE>``.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
MRI SCRIPTS
|
|
|
|
-----------
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
:program:`llvm-ar` understands a subset of the MRI scripting interface commonly
|
|
|
|
supported by archivers following in the ar tradition. An MRI script contains a
|
|
|
|
sequence of commands to be executed by the archiver. The :option:`-M` option
|
|
|
|
allows for an MRI script to be passed to :program:`llvm-ar` through the
|
|
|
|
standard input stream.
|
|
|
|
|
|
|
|
Note that :program:`llvm-ar` has known limitations regarding the use of MRI
|
|
|
|
scripts:
|
|
|
|
|
|
|
|
* Each script can only create one archive.
|
|
|
|
* Existing archives can not be modified.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
MRI Script Commands
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Each command begins with the command's name and must appear on its own line.
|
|
|
|
Some commands have arguments, which must be separated from the name by
|
|
|
|
whitespace. An MRI script should begin with either a :option:`CREATE` or
|
|
|
|
:option:`CREATETHIN` command and will typically end with a :option:`SAVE`
|
|
|
|
command. Any text after either '*' or ';' is treated as a comment.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: CREATE archive
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Begin creation of a regular archive with the specified name. Subsequent
|
|
|
|
commands act upon this ``archive``.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: CREATETHIN archive
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Begin creation of a thin archive with the specified name. Subsequent
|
|
|
|
commands act upon this ``archive``.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: ADDLIB archive
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Append the contents of ``archive`` to the current archive.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: ADDMOD <file>
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Append ``<file>`` to the current archive.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: DELETE <file>
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Delete the member of the current archive whose file name, excluding directory
|
|
|
|
components, matches ``<file>``.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: SAVE
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Write the current archive to the path specified in the previous
|
|
|
|
:option:`CREATE`/:option:`CREATETHIN` command.
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
.. option:: END
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
Ends the MRI script (optional).
|
|
|
|
|
|
|
|
EXIT STATUS
|
|
|
|
-----------
|
2012-05-09 00:50:35 +08:00
|
|
|
|
2019-10-21 21:13:31 +08:00
|
|
|
If :program:`llvm-ar` succeeds, it will exit with 0. Otherwise, if an error occurs, it
|
|
|
|
will exit with a non-zero value.
|