LLVM-AR(1)
๐ธ NAME ๐ธ
llvm-ar โ the LLVM archiver, bestie ๐ this is the LLVM manual, section 1, and we're about to make archive files make sense, fr fr.
๐ SYNOPSIS ๐
llvm-ar [-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive
[filesโฆ]
๐ฆ DESCRIPTION ๐ฆ
okay so <pink>llvm-ar</pink> is basically the cooler cousin of the classic Unix utility ar ๐ It takes a bunch of files โ think object files and LLVM bitcode files โ and archives them into one single archive library that you can link into a program. And like, it can hold any kind of file, not just the nerdy ones. By default llvm-ar generates a symbol table, which makes linking faster because the linker only has to consult the symbol table instead of digging through every single file member of the archive. efficiency, we love to see it โจ
llvm-ar can read archive files in SVR4, GNU, BSD and Darwin format, and it can write in the GNU, BSD, and Darwin style archive files. If you use an SVR4 format archive with the r (replace), d (delete), m (move) or q (quick update) operations, the archive gets reconstructed in whatever format --format says. glow up ๐
Here's where llvm-ar departs from previous ar implementations:
๐ซ The following option is not supported
[f]โ truncate inserted filenames
๐ 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. both, not either, periodt ๐
๐ Deterministic Archives
By default, llvm-ar always uses zero for timestamps and UIDs/GIDs, so it writes 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. pick your fighter ๐ซถ
๐ช 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. case girlies vs case-less girlies, iykyk ๐
โจ OPTIONS โจ
llvm-ar operations are compatible with other ar implementations. However, there are a few modifiers (L) that are not found in other ar implementations. The options for 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.
The minimal set of options is at least one operator and the name of the archive. that's the whole bare minimum, no cap ๐
โก Operations
d [NT]โ Delete files from the archive. TheNandTmodifiers 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. no drama, nothing happens ๐m [abi]โ Move files from one location in the archive to another. Thea,b, andimodifiers 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. relocating, main character energy ๐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. ๐ญ learn from our mistakes bestie
The p operation never modifies the archive. untouched, pristine, iconic ๐ธ
q [LT]โ 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 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. the whole menu, chef's kiss ๐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. unboxing video ๐
๐ง Modifiers (operation specific)
The modifiers below are specific to certain operations. See the Operations section to determine which modifiers are applicable to which operations. check the vibes first, always ๐ฆ
aโ When inserting or moving member files, this option specifies the destination of the new files as being after therelposmember. Ifrelposis not found, the files are placed at the end of the archive.relposcannot be consumed without eithera,bori. after, like "after you" ๐bโ When inserting or moving member files, this option specifies the destination of the new files as being before therelposmember. Ifrelposis not found, the files are placed at the end of the archive.relposcannot be consumed without eithera,bori. This modifier is identical to theimodifier.iโ A synonym for theboption.Lโ When quick appending an archive, instead quick append its members. This is a feature forllvm-arthat is not found ingnu-ar. exclusive, we're special ๐ฅNโ When extracting or deleting a member that shares its name with another member, thecountparameter 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. Ifcountis not supplied, the operation fails. count cannot be
ngl the original manpage sentence literally just stops there mid-thought ๐ญ we're keeping it real and keeping it exactly as-is.
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. timestamp drama ๐ฐ๏ธOโ Display member offsets inside the archive.Tโ Alias for--thin. In manyarimplementationsThas a different meaning, as specified by X/Open System interface. careful bestie, different meaning elsewhere โ ๏ธvโ When printing files or the archive table of contents, this modifier instructsllvm-arto include additional information in the output. verbose era โจ
๐ Modifiers (generic)
The modifiers below may be applied to any operation. free-for-all, apply them wherever ๐ซถ
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. shhh, no warning, just vibes ๐คซ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 ๐uโ Only update archive members with files that have more recent timestamps. fresh only ๐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.-Mโ This option allows for MRI scripts to be read through the standard input stream. No other options are compatible with this option. it's giving solo mission ๐--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. thin archive era, but only when you ask ๐ฆ--versionโ Display the version of thellvm-arexecutable.@<FILE>โ Read command-line options and commands from response file<FILE>.
๐ฟ MRI SCRIPTS ๐ฟ
okay bestie, plot twist: llvm-ar also speaks a lil dialect called MRI scripting โ it's the subset of the MRI scripting interface that's commonly supported by all those archivers carrying on the ar tradition. an MRI script is literally just a sequence of commands that the archiver runs through one by one, like a lil choreography. and the way you feed it one? the -M option, which lets you pipe an MRI script straight into llvm-ar through the standard input stream. slay. ๐
now, before you get too excited, llvm-ar has some known limitations with MRI scripts, and we're gonna be honest about them:
- Each script can only create one archive. one script, one archive, that's the vibe. ๐
- Existing archives can not be modified. like, at all. no editing, no touch-ups. ๐
๐ MRI Script Commands ๐
every command starts with the command's name, and it has to be on its own line โ no sharing lines, no cozying up. some commands take arguments, and those arguments must be separated from the name by whitespace. an MRI script should begin with either CREATE or CREATETHIN, and will typically wrap up with a SAVE. and any text after either * or ;? that's a comment, bestie โ the archiver is not reading it. ๐
CREATEarchive โ start creating a regular archive with the name you gave. every command after this one acts upon this archive. main character archive energy. ๐CREATETHINarchive โ same idea but for a thin archive with the specified name. subsequent commands act upon this archive too. โจADDLIBarchive โ append the contents of archive into the current archive. bringing friends along. ๐ซถADDMOD<file> โ append <file> to the current archive. one lil file at a time. ๐ธDELETE<file> โ delete the member of the current archive whose file name matches <file>, comparing excluding directory components. so it's matching on the basename only, iykyk. โ๏ธSAVEโ write the current archive out to the path you specified back in the previousCREATE/CREATETHINcommand. this is the moment. the grand finale. ๐ฌENDโ ends the MRI script. it's optional, so if you forget it, no biggie, but it's cute to include. ๐
๐ช EXIT STATUS ๐ช
if llvm-ar succeeds, it exits with 0. and if an error happens? it exits with a non-zero value. that's it, that's the whole story. ๐
โ๏ธ AUTHOR โ๏ธ
Maintained by the LLVM Team (https://llvm.org/). they're the ones keeping this whole thing iconic. ๐ฅ
ยฉ๏ธ COPYRIGHT ยฉ๏ธ
2003-2025, LLVM Project ๐
and that's a wrap on this whole page, bestie!! ๐ this was llvm-ar(1), dated 2025-05-22, coming at you from the LLVM source family (that lil 14 version tag, you know the one). go forth and archive responsibly, mwah ๐
โจ๐ฆ
๐ฆ where this page comes from
- ubuntu questing: llvm-14 1:14.0.6-20ubuntu3
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms