LLVM-AR(1)
okay bestie, this is LLVM-AR(1) from the LLVM manual, and itβs literally the archiver page you didnβt know you needed π β¨
πΈ NAME πΈ
llvm-ar β LLVM archiver. short, sweet, iconic π«Ά
β¨ SYNOPSIS β¨
llvm-ar [-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive
[files...]
π¦ DESCRIPTION π¦
The llvm-ar command 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 bestie, the archive can contain any kind of file β itβs giving flexible. 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. periodt π
The llvm-ar command can be used to 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. slay π
hereβs where llvm-ar departs from previous ar implementations, and this is the part where you go βoh πβ:
π The following option is not supported π
[f]β truncate inserted filenames. not supported, bestie β she does not do this one π
π The following options are ignored for compatibility π
--plugin=<string>β load a plugin which adds support for other file formats. ignored for compatibility[l]β ignored inar.
π§ Symbol Table π§
Since llvm-ar supports bitcode files, the symbol table it creates includes both native and bitcode symbols. no cap, thatβs the tea β
π 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. highkey useful π«Ά
π 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. thatβs the vibe check β
π OPTIONS π
okay so real talk β the way llvm-ar options work is genuinely compatible with other ar implementations, no cap. literally the only exception is a couple of modifiers (L) that you won't find anywhere else. here's the vibe: the options tell llvm-ar one single basic Operation to do to the archive, plus a bunch of Modifiers for that Operation, plus the name of the archive file, plus optionally a list of file names. and if you don't give the files option? it usually means either "none" or "all" members, depending on what operation you're doing. lowkey confusing but we get into it below. π
the absolute minimum 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 here. the files option tells you which members get yeeted from the archive. and ngl, it is not an error if a file you named isn't actually in the archive β it just vibes. if you specify no files at all, the archive isn't modified. π«Άm [abi]β Move files from one location in the archive to another. thea,b, andimodifiers apply. all the files get moved to whatever location those modifiers point at. no modifiers? they all get moved to the end of the archive. no files specified? archive stays exactly as it was. β¨p [v]β Print files to the standard output stream. no files specified means the entire archive gets printed. add thevmodifier andllvm-aralso prints the name of the file it's outputting. > β οΈ printing binary files is ill-advised β they might confuse your terminal settings, bestie, and your terminal does not deserve that. good news: thepoperation never modifies the archive. ever.q [LT]β Quickly append files to the end of the archive without removing duplicates. no files specified? archive not modified, periodt. now the behavior when you append one archive to another depends on whether you're using theLandTmodifiers:- appending a regular archive to a regular archive will append the archive file. if the
Lmodifier is specified, the members get appended instead. - appending a regular archive to a thin archive requires the
Tmodifier and will append the archive file. theLmodifier is not supported here. - appending a thin archive to a regular archive will append the archive file. if the
Lmodifier is specified, the members get appended instead. - appending a thin archive to a thin archive will always quick append its members. always.
- 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 don't exist yet. thea,b,Tandumodifiers apply. no files specified means no modification. simple as that. π¦t [vO]β Print the table of contents. with no modifiers it 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 (ignored when extracting files and set to placeholder values when adding), the size, and the date. with theOmodifier it displays member offsets. if you name files, the listing is only for those files. no files named? you get the table of contents for the whole archive. π
π side quest: the rendered manpage literally shows this heading as t[v] .. option:: t [vO] β leftover rst crumbs. we love a messy queen.
Vβ a synonym for the--versionoption. that's it, that's the whole thing. βx [oP]β Extract archive members back to files. theomodifier applies. this operation pulls the indicated files out of the archive and writes them back to the operating system's file system. no files specified? the whole archive gets extracted. main character energy fr fr. πΈ
π Modifiers (operation specific)
these modifiers below are specific to certain operations. peek at the Operations section above to figure out which modifiers go with which operations β they are not universal bestie.
aβ when inserting or moving member files, this specifies the destination of the new files as being after the relpos member. if relpos isn't found, the files get placed at the end of the archive. and relpos cannot be consumed without eithera,bori.bβ when inserting or moving member files, this specifies the destination of the new files as being before the relpos member. if relpos isn't found, files go to the end of the archive. relpos cannot be consumed without eithera,bori. this modifier is literally identical to theimodifier.iβ a synonym for theboption. π―Lβ when quick appending an archive, quick append its members instead. this is a feature forllvm-arthat is not found ingnu-arβ so don't go looking for it there, iykyk.Nβ when extracting or deleting a member that shares its name with another member, the count parameter lets you supply a positive whole number that selects the instance of the given name, with"1"meaning the first instance. ifNisn't specified, the first member of that name gets selected. if count isn't supplied, the operation fails.
π heads up β the source page genuinely cuts off here mid-sentence: "count cannot be". that's all she wrote.
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 instead.Oβ display member offsets inside the archive.Tβ alias for--thin. > β οΈ in manyarimplementationsTmeans something totally different, as specified by X/Open System interface. so like, check whicharyou're talking to, bestie.vβ when printing files or the archive table of contents, this modifier tellsllvm-arto include additional information in the output. more info = more β¨loreβ¨.
β¨ Modifiers (generic)
these ones you can throw at any operation. universal slay. π
cβ for ther(replace) andq(quick update) operations,llvm-arwill always create the archive if it doesn't exist. normallyllvm-arprints a warning message saying the archive is being created β using this modifier turns that warning off. silence is golden. π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, since some of them 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. it can also be used as an operation. πSβ the opposite of thesmodifier. it tellsllvm-arto not build the symbol table. if bothsandSare used, the last modifier to occur in the options wins. farewell to the loser. πuβ only update archive members with files that have more recent timestamps. no fresh timestamp, no update. π°οΈUβ use actual timestamps and UIDs/GIDs.
π Other
--format=<type>β this option lets you selectdefault,gnu,darwin,bsdorcoffas the<type>. when creating an archive with the default<type>, :program:llvm-arwill attempt to infer it from the input files and fall back to the default toolchain target if it's unable to do so. detective work, honestly. π-h,--helpβ print a summary of command-line options and their meanings. the classic cry for help. π«Ά-Mβ this option lets MRI scripts be read through the standard input stream. > β οΈ no other options are compatible with this one. it's a solo act, main character energy only.--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. πͺ vs π§--thinβ when creating or modifying an archive, this option says the archive will be thin. by default archives are not created as thin archives, and when modifying a thin archive, it gets converted to a regular archive. (yes, it changes the vibe. be aware. π)--versionβ display the version of thellvm-arexecutable.-X modeβ specifies the type of object filellvm-arwill recognise.modemust be one of these: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. and the -X flag overrides the OBJECT_MODE variable. flag wins, always. β
@<FILE>β read command-line options and commands from response file<FILE>.
π§ MRI SCRIPTS π§
llvm-ar understands a subset of the MRI scripting interface that's commonly supported by archivers following in the ar tradition. an MRI script is just a sequence of commands for the archiver to execute, and the -M option lets you pass an MRI script to llvm-ar through the standard input stream. π
β οΈ but bestie, llvm-ar has known limitations with MRI scripts and you need to know them: - 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 sit 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. cute, right? π
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 of archive to 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. the grand finale. πENDβ ends the MRI script. optional, but iconic. β¨
π«Ά EXIT STATUS π«Ά
if llvm-ar succeeds, it exits with 0. otherwise, if an error occurs, it exits with a non-zero value. that's the whole mood. π
β¨ AUTHOR β¨
So who's the main character behind all this? π
This page is maintained by the LLVM Team β you can find them at https://llvm.org/ π«Ά. That's it, that's the whole credit. They keep it alive, they keep it updated, and honestly? Slay. π
π COPYRIGHT π
The copyright line, verbatim, because legal stuff is not the vibe to freestyle:
2003-2025, LLVM Project
That's 2003-2025, LLVM Project β two decades-plus of tooling, no cap. ποΈβ¨
And that's the whole page, bestie! π¦ You made it to the end, which means the vibe check is complete. π This was LLVM-AR from version 19, dated 2025-01-17 β screenshot it, bookmark it, tattoo it on your forearm, whatever works for you. ππ
Go archive something iconic. ππ₯π
π¦ where this page comes from
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm19 19.1.7-160000.2.2 Β· 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