LLVM-AR(1)
π llvm-ar β LLVM archiver π
β¨ NAME β¨
llvm-ar β the LLVM archiver. Thatβs the name, bestie. π
π¦ SYNOPSIS π¦
llvm-ar [-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive
[filesβ¦]
π₯ DESCRIPTION π₯
Okay so 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 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. Slay. π
The 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 r (replace), d (delete), m (move) or q (quick update) operations, the archive will be reconstructed in the format defined by --format.
Hereβs where llvm-ar departs from previous ar implementations:
π« The following option is not supported π«
[f]β truncate inserted filenames. Not supported, 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, honestly. β¨
π 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. No cap. π
πͺ 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 π
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.
π 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.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.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. The p operation 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. 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[v],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) πΈ
The modifiers below are specific to certain operations. See the Operations section to determine which modifiers are applicable to which operations.
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.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.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 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β 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.vβ When printing files or the archive table of contents, this modifier instructsllvm-arto include additional information in the output.
π§ Modifiers (generic) π§
The modifiers below may 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-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.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.-Mβ This option allows for MRI scripts to be read through the standard input stream.
π¨ No other options are compatible with this option.
--rsp-quoting=<type>β This option selects the quoting style<type>for response files, eitherposixorwindows. The default when on Windows iswindows, otherwise the default isposix.--versionβ Display the version of thellvm-arexecutable.@<FILE>β Read command-line options and commands from response file<FILE>.
π MRI SCRIPTS π
okay so this is the fun part β llvm-ar also speaks a subset of the MRI scripting interface, which is the scripting thing basically all the archivers in the ar tradition support. An MRI script is just a lil list of commands that the archiver runs for you, one after another. And the way you feed one in? The -M option, which lets you pass an MRI script to llvm-ar through the standard input stream. slay. π
But bestie, i gotta be honest with you, there are known limitations with MRI scripts in llvm-ar and you need to know them:
- Each script can only create one archive. one. that's it. no multitasking.
- Existing archives can not be modified. nope. not happening. π
β¨ MRI Script Commands β¨
every command starts with the command's name, and it has to be on its own line. like, its own line, periodt. some commands take arguments, and those arguments must be separated from the name by whitespace.
an MRI script should begin with either a CREATE or a CREATETHIN command, and it'll typically wrap up with a SAVE command. oh and β any text after either * or ; is treated as a comment. cute, right? π
CREATEarchive β begin creation of a regular archive with the specified name. and like, every command after this one acts upon this archive. main character archive energy πCREATETHINarchive β begin creation of a thin archive with the specified name. same deal, subsequent commands act upon this one. π¦ADDLIBarchive β append the contents of archive to the current archive. like bringing your friend's whole playlist into yours.ADDMOD<file> β append <file> to the current archive. one single file, just vibes.DELETE<file> β delete the member of the current archive whose file name, excluding directory components, matches <file>. yeah so the path doesn't matter, just the file name part. keep that in mind πSAVEβ write the current archive to the path you specified in the previousCREATE/CREATETHINcommand. this is the "actually commit it" step, don't forget it π«ΆENDβ ends the MRI script. it's optional! you don't have to say goodbye, but you can. π
π EXIT STATUS π
if llvm-ar succeeds, it exits with 0. if an error happens, it exits with a non-zero value. that's it, that's the whole vibe check β
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). iconic behavior fr fr π
π COPYRIGHT π
2003-2023, LLVM Project
and that's the whole page bestie!! π this wasllvm-ar, dated2023-07-14, and yeah it's from the LLVM Project β go forth and archive responsibly, i'm obsessed with you π§β¨πΈ
π¦ where this page comes from
- ubuntu jammy: llvm-13 1:13.0.1-2ubuntu2.2 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms