LLVM-AR(1)
β¨ NAME β¨
llvm-ar β the LLVM archiver. That's the whole name, bestie, and LLVM-AR(1) is the manual page you're in. It's giving "I archive files and I know things" π.
πΈ SYNOPSIS πΈ
llvm-ar [-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive
[files...]
π DESCRIPTION π
okay so llvm-ar is similar to the common Unix utility ar. It archives several files, such as objects and LLVM bitcode files, into a single archive library that can be linked into a program. But plot twist: the archive can contain any kind of file. By default, 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. Literally so efficient β¨.
The llvm-ar command can read archive files in SVR4, GNU, BSD, Big Archive, and Darwin format, and write in the GNU, BSD, Big Archive, and Darwin style archive files. If an SVR4 format archive is used with the r (replace), d (delete), m (move) or q (quick update) operations, the archive will be reconstructed in the format defined by --format. Iykyk π¦.
Here's where llvm-ar departs from previous ar implementations:
π« The following option is not supported π«
[f]β truncate inserted filenames.
Yeah, that one's a no from llvm-ar, bestie π.
π The following options are ignored for compatibility π
--plugin=<string>β load a plugin which adds support for other file formats.[l]β ignored inar.
π§ Symbol Table π§
Since llvm-ar supports bitcode files, the symbol table it creates includes both native and bitcode symbols. Iconic behavior, no cap π
.
π― Deterministic Archives π―
By default, llvm-ar always uses zero for timestamps and UIDs/GIDs to write archives in a deterministic mode. This is equivalent to the D modifier being enabled by default. If you wish to maintain compatibility with other ar implementations, you can pass the U modifier to write actual timestamps and UIDs/GIDs. So if you need those actual timestamps and IDs, that's your move π.
πͺ Windows Paths πͺ
When on Windows llvm-ar treats the names of archived files in the same case sensitive manner as the operating system. When on a non-Windows machine llvm-ar does not consider character case. Periodt π«Ά.
β¨ OPTIONS β¨
okay so the tea on llvm-ar options: they're compatible with other ar implementations, bestie. like, you can swap in and out, no drama. BUT there's a couple of modifiers (hi, L) that you literally will not find anywhere else in other ar implementations β that's our girl's signature move π
.
So how do the options work? You give llvm-ar a single basic Operation to perform on the archive, a bunch of Modifiers for that Operation, the name of the archive file, and optionally a list of file names. If the files option is, like, not specified, it generally means either "none" or "all" members β depends on the operation, iykyk. The Options, Operations and Modifiers are all explained in the sections below π«Ά.
The minimal set of options is at least one operator and the name of the archive. that's it. that's the floor.
π οΈ Operations
d [NT]β Delete files from the archive ποΈ. TheNandTmodifiers apply to this one. The files options specify which members should be removed from the archive. And ngl, it is not an error if a specified file does not appear in the archive β she's chill like that. If no files are specified, the archive is not modified.m [abi]β Move files from one location in the archive to another π. Thea,b, andimodifiers apply here. All the files get moved to the location given by the modifiers. No modifiers used? Then the files get moved to the end of the archive. If no files are specified, the archive is not modified.p [v]β Print files to the standard output stream π¨οΈ. If no files are specified, the entire archive is printed. With thevmodifier,llvm-aralso prints out the name of the file being output. > Printing binary files is ill-advised as they might confuse your terminal settings π like genuinely, don't. Thepoperation never modifies the archive.q [LT]β Quickly append files to the end of the archive without removing duplicates. If no files are specified, the archive is not modified. Now, the behavior when appending one archive to another depends upon whether theLandTmodifiers are used π:- Appending a regular archive to a regular archive will append the archive file. If the
Lmodifier is specified the members will be appended instead. - Appending a regular archive to a thin archive requires the
Tmodifier and will append the archive file. TheLmodifier is not supported. - Appending a thin archive to a regular archive will append the archive file. If the
Lmodifier is specified the members will be appended instead. - Appending a thin archive to a thin archive will always quick append its members.
- Appending a regular archive to a regular archive will append the archive file. If the
r [abTu]β Replace existing files or insert them at the end of the archive if they do not exist β¨. Thea,b,Tandumodifiers apply to this operation. If no files are specified, the archive is not modified.t [vO]β Print the table of contents π. Without any modifiers, this operation just prints the names of the members to the standard output stream. With thevmodifier,llvm-aralso 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 theOmodifier, 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.Vβ A synonym for the--versionoption π·οΈ.x [oP]β Extract archive members back to files π¦. Theomodifier 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.
π Modifiers (operation specific)
These modifiers below are specific to certain operations β so check the Operations section above to figure out which modifiers are applicable to which operations, bestie. Don't just vibe-and-hope.
aβ 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 eithera,bori.bβ 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 eithera,bori. This modifier is identical to theimodifier.iβ A synonym for theboption. twins fr π«Ά.Lβ When quick appending an archive, instead quick append its members. This is a feature forllvm-arthat is not found in gnu-ar β¨ exclusive behaviour, we love to see it.Nβ 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. IfNis not specified the first member of that name will be selected. If count is not supplied, the operation fails. count cannot beoβ 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.Oβ Display member offsets inside the archive.Tβ Alias for--thin. > Heads up though: in manyarimplementationsThas a different meaning, as specified by X/Open System interface. so like, don't assume, okay? πvβ When printing files or the archive table of contents, this modifier instructsllvm-arto include additional information in the output π¬.
π« Modifiers (generic)
These ones below may be applied to any operation. universal. for everyone. we love inclusivity.
cβ For ther(replace) andq(quick update) operations,llvm-arwill always create the archive if it doesn't exist. Normally,llvm-arwill print a warning message indicating that the archive is being created. Using this modifier turns off that warning π€«.Dβ Use zero for timestamps and UIDs/GIDs. This is set by default.Pβ 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.sβ This modifier requests that an archive index (or symbol table) be added to the archive, as if usingranlib. The symbol table will contain all the externally visible functions and global variables defined by all the bitcode files in the archive. By defaultllvm-argenerates symbol tables in archives. This can also be used as an operation π.Sβ This modifier is the opposite of thesmodifier. It instructsllvm-arto not build the symbol table. If bothsandSare used, the last modifier to occur in the options will prevail β last one standing wins, periodt.uβ Only update archive members with files that have more recent timestamps π.Uβ Use actual timestamps and UIDs/GIDs.
π Other
--format=<type>β This option allows fordefault,gnu,darwinorbsd<type> to be selected. When creating an archive, <type> will default to that of the host machine π₯οΈ.-h,--helpβ Print a summary of command-line options and their meanings. your lil cheat sheet π.-Mβ This option allows for MRI scripts to be read through the standard input stream. > No other options are compatible with this option. like, none. she's a solo act π .--output=<dir>β Specify a directory where archive members should be extracted to. By default the current working directory is used.--rsp-quoting=<type>β This option selects the quoting style<type>for response files, eitherposixorwindows. The default when on Windows iswindows, otherwise the default isposix.--thinβ 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.--versionβ Display the version of thellvm-arexecutable π·οΈ.-X modeβ Specifies the type of object filellvm-arwill recognise. The mode must be one of the following:32β Process only 32-bit object files.64β Process only 64-bit object files.32_64β Process both 32-bit and 64-bit object files.anyβ Process all object files.
The default is to process 32-bit object files (ignore 64-bit objects). The mode can also be set with the OBJECT_MODE environment variable. For example, OBJECT_MODE=64 causes ar to process any 64-bit objects and ignore 32-bit objects. > The -X flag overrides the OBJECT_MODE variable. flag wins, always.
@<FILE>β Read command-line options and commands from response file<FILE>.
π MRI SCRIPTS
okay so 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 -M option allows for an MRI script to be passed to llvm-ar through the standard input stream.
But bestie, please know that llvm-ar has known limitations regarding the use of MRI scripts π: - Each script can only create one archive. - Existing archives can not be modified.
π§ MRI Script Commands
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 CREATE or CREATETHIN command and will typically end with a SAVE command. Any text after either '*' or ';' is treated as a comment π¬.
CREATE archiveβ Begin creation of a regular archive with the specified name. Subsequent commands act upon this archive.CREATETHIN archiveβ Begin creation of a thin archive with the specified name. Subsequent commands act upon this archive.ADDLIB archiveβ Append the contents ofarchiveto the current archive.ADDMOD <file>β Append<file>to the current archive.DELETE <file>β Delete the member of the current archive whose file name, excluding directory components, matches<file>.SAVEβ Write the current archive to the path specified in the previousCREATE/CREATETHINcommand πΎ.ENDβ Ends the MRI script (optional).
π¦ EXIT STATUS
If llvm-ar succeeds, it will exit with 0 β¨. Otherwise, if an error occurs, it will exit with a non-zero value π.
π AUTHOR
Maintained by the LLVM Team (https://llvm.org/). icons fr π
π COPYRIGHT π
Okay so before you close the tab β the legal bit, but make it cute π
The fine print says:
2003-2023, LLVM Project
So yeah β the LLVM Project owns the copyright, and the years on record are 2003-2023. That's two whole decades of people writing compiler code so your build could go brrr ππ«Ά Give them their flowers fr fr π
and that's the whole page, bestie β¨ you made it to the end, iconic behavior honestly π this was LLVM-AR(1), version 15, dated 2023-01-14 β go forth and archive your object files with main character energy π¦ππ«Ά
π¦ where this page comes from
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms