LLVM-AR(1)

πŸ’– LLVM-AR(1) β€” the LLVM archiver, bestie edition πŸ’–

okay so this is the manual page for llvm-ar, section 1, straight outta LLVM. it's giving "archiver but make it modern" and honestly? we're obsessed. let's get into it 🫢


✨ NAME ✨

llvm-ar β€” LLVM archiver. that's it, that's the name, short and iconic πŸ’…


🌈 SYNOPSIS 🌈

llvm-ar [-]{dmpqrstx}[abcDilLNoOPsSTuUvV] [relpos] [count] archive
[files...]

like, that's a lot of letters, i know 😭 but every single one of them matters, so don't skip a single character, fr fr.


πŸŽ€ DESCRIPTION πŸŽ€

so llvm-ar is basically the cooler cousin of the common Unix utility ar. what it does is take a bunch of files β€” think objects and LLVM bitcode files β€” and archive them all into one single archive library that you can link into a program. ✨

but here's the tea: the archive can contain any kind of file. literally anything. it's not picky, it's not gatekeeping. πŸ’…

and by default, llvm-ar generates a symbol table, which makes linking way faster because only the symbol table needs to be consulted β€” not every single individual file member of the archive. no cap, that's a massive slay. πŸ”₯

llvm-ar can also read archive files in these formats:

  • SVR4
  • GNU
  • BSD
  • Big Archive
  • Darwin

and it can write in these styles:

  • GNU
  • BSD
  • Big Archive
  • Darwin
heads up bestie πŸ‘€ if an SVR4 format archive gets 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. so yeah, it changes the vibe on you. don't be surprised. πŸ¦‹

now here's where llvm-ar departs from previous ar implementations β€” it's doing its own thing, main character energy only πŸ‘‘

πŸ™ˆ The following option is not supported πŸ™ˆ

  • [f] β€” truncate inserted filenames. nope. not supported. it's simply not invited to the party. πŸ’€

🧚 The following options are ignored for compatibility 🧚

these are just here so nothing breaks, they don't actually do anything, they're like the decorative pillows of options πŸ›‹οΈβœ¨

  • --plugin=<string> β€” load a plugin which adds support for other file formats
  • [l] β€” ignored in ar

⭐ Symbol Table ⭐

since llvm-ar supports bitcode files, the symbol table it creates includes both native and bitcode symbols. both. at the same time. multitasking icon behavior. πŸ’…

πŸ“ 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 β€” so like, it's already on, you don't gotta ask. πŸŽ€

if you wish to maintain compatibility with other ar implementations, you can pass the U modifier to write actual timestamps and UIDs/GIDs. that's the tradeoff bestie, deterministic vs. matching the other girlies. 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. so case matters. πŸ‘€

when on a non-Windows machine, llvm-ar does not consider character case. so FILE.o and file.o? same vibe, doesn't care. ✨


and that's part one, babes β€” there's more coming so don't go anywhere πŸ«ΆπŸ’–

πŸ’… OPTIONS πŸ’…

okay so first things first: llvm-ar operations are compatible with other ar implementations β€” we play nice, bestie. BUT there are a few modifiers (L) that you will not find in other ar implementations, so that one is giving llvm-exclusive πŸ’….

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 isn't specified, it generally means either "none" or "all" members, depending on the operation. (iykyk.) The Options, Operations and Modifiers are explained in the sections below, don't worry bestie we're getting there 🌸

The minimal set of options is at least one operator and the name of the archive. periodt.

✨ Operations ✨

  • d [NT] β€” delete files from the archive. The N and T modifiers 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, so no stress 😌. If no files are specified, the archive is not modified.
  • m [abi] β€” move files from one location in the archive to another. The a, b, and i modifiers 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 the v modifier, llvm-ar also prints out the name of the file being output.
Printing binary files is ill-advised 😭 as they might confuse your terminal settings. you've been warned, bestie.

The p operation never modifies the archive. she's just here to vibe and read πŸ‘‘

  • 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 the L and T modifiers are used:
    • Appending a regular archive to a regular archive will append the archive file. If the L modifier is specified the members will be appended instead.
    • Appending a regular archive to a thin archive requires the T modifier and will append the archive file. The L modifier is not supported.
    • Appending a thin archive to a regular archive will append the archive file. If the L modifier is specified the members will be appended instead.
    • Appending a thin archive to a thin archive will always quick append its members.
  • r [abTu] β€” replace existing files or insert them at the end of the archive if they do not exist. The a, b, T and u modifiers apply to this operation. If no files are specified, the archive is not modified.
  • t [vO] β€” print the table of contents. (you'll also see this written as t[v] in the wild, same energy ✨) Without any modifiers, this operation just prints the names of the members to the standard output stream. With the v modifier, llvm-ar also prints out the file type (B=bitcode, S=symbol table, blank=regular file), the permission mode, the owner and group β€” which are ignored when extracting files and set to placeholder values when adding β€” size, and the date. With the O modifier, 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 --version option.
  • x [oP] β€” extract archive members back to files. The o modifier 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. spring cleaning but make it bytes 🧚

πŸŽ€ Modifiers (operation specific) πŸŽ€

The modifiers below are specific to certain operations. See the Operations section to determine which modifiers are applicable to which operations. no skipping ahead bestie, it's all connected πŸ¦‹

  • 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 either a, b or i.
  • 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 either a, b or i. This modifier is identical to the i modifier.
  • i β€” A synonym for the b option. twins fr πŸ’ž
  • L β€” When quick appending an archive, instead quick append its members. This is a feature for llvm-ar that is not found in gnu-ar. exclusive, we don't gatekeep... ok we kind of gatekeep πŸ’…
  • 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. If N is not specified the first member of that name will be selected. If count is not supplied, the operation fails. (heads up: the source page's sentence trails off right there β€” *count* cannot be … πŸ’€ nothing after that, that's just how it 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.
  • O β€” Display member offsets inside the archive.
  • T β€” Alias for --thin. In many ar implementations T has a different meaning, as specified by X/Open System interface. ⚠️ so don't assume, ok?
  • v β€” When printing files or the archive table of contents, this modifier instructs llvm-ar to include additional information in the output. verbose era πŸ‘‘

πŸ‘‘ Modifiers (generic) πŸ‘‘

The modifiers below may be applied to any operation. universal icons ✨

  • c β€” For the r (replace) and q (quick update) operations, llvm-ar will always create the archive if it doesn't exist. Normally, llvm-ar will print a warning message indicating that the archive is being created. Using this modifier turns off that warning. 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, 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 using ranlib. The symbol table will contain all the externally visible functions and global variables defined by all the bitcode files in the archive. By default llvm-ar generates symbol tables in archives. This can also be used as an operation.
  • S β€” This modifier is the opposite of the s modifier. It instructs llvm-ar to not build the symbol table. If both s and S are 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.
  • U β€” Use actual timestamps and UIDs/GIDs.

πŸ¦‹ Other πŸ¦‹

  • --format=<type> β€” This option allows for default, gnu, darwin, bsd or coff <type> to be selected. When creating an archive with the default <type>, llvm-ar will attempt to infer it from the input files and fallback to the default toolchain target if unable to do so.
  • -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 a solo act, no plus-ones πŸ™ˆ
  • --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, either posix or windows. The default when on Windows is windows, otherwise the default is posix.
  • --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. (yes, it changes on you. plot twist.)
  • --version β€” Display the version of the llvm-ar executable.
  • -X mode β€” Specifies the type of object file llvm-ar will 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.

  • @<FILE> β€” Read command-line options and commands from response file <FILE>.

🌈 MRI SCRIPTS 🌈

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.

Note 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. cute little syntax, honestly πŸ’–

  • 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 previous CREATE/CREATETHIN command.
  • 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 that, no cap 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Maintained by the LLVM Team (<https://llvm.org/>). Yes bestie, actual humans, an entire team of them, keeping this thing alive and glowing πŸ’–


2003-2026, LLVM Project

Twenty-three years of slay. The LLVM Project has been holding it down since 2003 and they are still at it in 2026, no cap 🫢


Okay that's the whole page, you made it to the end, I'm so proud of you fr fr 🌸

This was LLVM-AR(1) from the LLVM Project, page version 21, dated 2026-07-22. Go archive something iconic, bestie βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from