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 in ar

๐Ÿ”ฎ 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. 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. 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. 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. relocating, main character energy ๐Ÿšš
  • 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. ๐Ÿ˜ญ 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 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. 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, 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. the whole menu, chef's kiss ๐Ÿ‘‘
  • 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. 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 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. after, like "after you" ๐Ÿ’…
  • 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.
  • 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're special ๐Ÿ”ฅ
  • 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. 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 many ar implementations T has 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 instructs llvm-ar to 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 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. 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 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. fresh only ๐Ÿ“
  • U โ€” Use actual timestamps and UIDs/GIDs.

๐ŸŒธ Other

  • --format=<type> โ€” This option allows for default, gnu, darwin or bsd <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, 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. thin archive era, but only when you ask ๐Ÿฆ‹
  • --version โ€” Display the version of the llvm-ar executable.
  • @<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. ๐Ÿ’–

  • CREATE archive โ€” start creating a regular archive with the name you gave. every command after this one acts upon this archive. main character archive energy. ๐Ÿ‘‘
  • CREATETHIN archive โ€” same idea but for a thin archive with the specified name. subsequent commands act upon this archive too. โœจ
  • ADDLIB archive โ€” 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 previous CREATE/CREATETHIN command. 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. ๐Ÿ”ฅ


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