LLVM-AR(1)
llvm-ar π welcome to the LLVM manual, section 1 β yes bestie, the archiver page, and we're doing the whole thing, no skipping. π
β¨ NAME β¨
llvm-ar β the LLVM archiver. Short name, big job. π
π¦ SYNOPSIS π¦
llvm-ar [-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive
[filesβ¦]
πΈ DESCRIPTION πΈ
okay so llvm-ar is basically the cooler cousin of the classic Unix utility ar. π It takes a bunch of files β object files, LLVM bitcode files, whatever β and archives them into one single archive library that you can then link into a program. The way that it can hold literally any kind of file too, not just the object-file girlies. π
And by default it generates a symbol table, which is the slay part, because it makes linking so much faster β the linker only has to consult that symbol table instead of digging through each individual file member of the archive. Efficiency queen. β¨
The llvm-ar command can read archive files in SVR4, GNU, BSD, Big Archive, and Darwin format, and it can write in GNU, BSD, Big Archive, and Darwin style archive files. But here's the tea π: 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 defines. Not a choice, it just happens. π«
Here's where llvm-ar departs from previous ar implementations:
π« The following option is not supported
[f]β truncate inserted filenames. Nope. Not supported. Not happening. π
π The following options are ignored for compatibility
--plugin=<string>β load a plugin which adds support for other file formats. Ignored, bestie, it's just there so old scripts don't cry. π[l]β ignored inar. Also just vibing there for compatibility. π
β Symbol Table
Since llvm-ar supports bitcode files, the symbol table it creates includes both native and bitcode symbols. Both. At once. Iconic behavior. π
π§ Deterministic Archives
By default, llvm-ar always uses zero for timestamps and UIDs/GIDs so it writes archives in a deterministic mode. This is literally equivalent to the D modifier being enabled by default. π
If you wish to maintain compatibility with otherarimplementations, you can pass theUmodifier to write actual timestamps and UIDs/GIDs. That's the tradeoff, bestie β determinism or legacy, 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. But when on a non-Windows machine, llvm-ar does not consider character case. So yeah β case sensitivity is giving "depends on the OS, iykyk". πΈ
π OPTIONS π
okay bestie, so here's the tea: llvm-ar's operations play nice with other ar implementations β they're compatible, fr fr. but there are a few modifiers (L) that you literally won't find in any other ar out there. exclusive behavior, we love that. β¨
the options for llvm-ar do a few jobs: they pick a single basic Operation to perform on the archive, a whole buffet of Modifiers for that Operation, the name of the archive file, and optionally a list of file names. and here's the vibe: if the files option isn't specified, it generally means either "none" or "all" members β depends on which operation you're running. Options, Operations and Modifiers all get explained in the sections below, no cap.
the absolute minimum you can get away with? at least one operator plus the name of the archive. that's the bar. π«Ά
π¦ Operations π¦
d [NT]β delete files from the archive. theNandTmodifiers apply here. the files options tell it which members to remove. and it is not an error if a file you named doesn't actually appear in the archive, so don't panic. if you specify no files at all, the archive is not modified. πm [abi]β move files from one spot in the archive to another. thea,bandimodifiers apply. all the files get moved to the location the modifiers give. no modifiers used? they go to the end of the archive. no files specified? archive is not modified, periodt.p [v]β print files to the standard output stream. no files specified = the entire archive gets printed. with thevmodifier,llvm-aralso prints out the name of the file it's outputting. β οΈ printing binary files is ill-advised, bestie, because they might confuse your terminal settings. thepoperation never modifies the archive, so at least there's that.q [LT]β quickly append files to the end of the archive without removing duplicates. no files specified? the archive is not modified. the behavior when you append one archive to another depends on whetherLandTare in play:- 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.
- 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 = archive is not modified.t[v] .. option:: 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, 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 gets printed. πVβ a synonym for the--versionoption.x [oP]β extract archive members back to files. theomodifier applies here. this retrieves the indicated files from the archive and writes them back to the operating system's file system. no files specified = the entire archive gets extracted. π
πΈ Modifiers (operation specific) πΈ
these ones are specific to certain operations. peek at the Operations section above to figure out which modifiers go with which operations, iykyk.
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. 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, the files get 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.Lβ when quick appending an archive, quick append its members instead. this is a feature forllvm-arthat is not found ingnu-ar. special. iconic. β¨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" indicating the first instance. ifNisn't specified, the first member of that name will be selected. if count isn't 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 instead.Oβ display member offsets inside the archive.Tβ alias for--thin. in manyarimplementations,Thas a different meaning, as specified by X/Open System interface. πvβ when printing files or the archive table of contents, this modifier tellsllvm-arto include additional information in the output.
π Modifiers (generic) π
these ones can be applied to any operation.
cβ for ther(replace) andq(quick update) operations,llvm-arwill always create the archive if it doesn't exist. normally,llvm-arprints a warning message saying the archive is being created β using this modifier turns that warning off.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. super useful when you're 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 you'd usedranlib. 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, fun fact.Sβ the opposite of thesmodifier. it tellsllvm-arto not build the symbol table. if bothsandSare used, the last modifier to occur in the options will prevail. 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 letsdefault,gnu,darwinorbsd<type> be selected. when creating an archive, <type> defaults to that of the host machine.-h,--helpβ print a summary of command-line options and their meanings. π«Ά-Mβ this option lets MRI scripts be read through the standard input stream. no other options are compatible with this option. don't even try it.--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 aren't created as thin archives, and when modifying a thin archive, it gets converted to a regular archive. π--versionβ display the version of thellvm-arexecutable.-X modeβ specifies the type of object filellvm-arwill recognise. mode must 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. the -X flag overrides the OBJECT_MODE variable. π
@<FILE>β read command-line options and commands from response file <FILE>.
π MRI SCRIPTS π
llvm-ar understands a subset of the MRI scripting interface that archivers following in the ar tradition commonly support. an MRI script contains a sequence of commands for the archiver to execute. the -M option lets you pass an MRI script to llvm-ar through the standard input stream.
heads up bestie, llvm-ar has known limitations when it comes to MRI scripts: π - each script can only create one archive. - existing archives can not be modified.
β MRI Script Commands β
every command begins with the command's name and must appear on its own line. some commands take arguments, and those 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 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.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. simple as. β¨
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/).
π COPYRIGHT π
okay so this whole thing? the entire manual page you just read, every flag, every script, every little byte of it β it's all wrapped up in one copyright line and here it is, bestie, exactly as it is:
2003-2024, LLVM Project
that's it, that's the whole vibe. twenty-one whole years of the LLVM Project holding it down from 2003 all the way through 2024, and we are obsessed with the longevity. main character energy for two decades straight, no cap. π
and that's a wrap on the whole page, bestie!! π this was LLVM-AR(1), version</ purple> 15, dated 2024-04-14 β so if you're quoting it in a bug report or an essay or a group chat, now you know exactly which one you're holding. β¨
go archive something iconic, you absolute legend. π π¦πΈ bye bestie!! π«Ά
π¦ where this page comes from
- ubuntu noble: llvm-16 1:16.0.6-23ubuntu4 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms