LLVM-IFS(1)
π
LLVM-IFS(1) β like, the llvm-ifs page, but make it make sense
okay bestie, buckle up, because llvm-ifs is genuinely one of those tools that sounds scary and then turns out to be iconic. it's the local llvm-ifs manual, and we're gonna go through the whole thing together, no skipped sections, no skipped flags, periodt. π
β¨ NAME β¨
llvm-ifs β shared object stubbing tool π«Ά
like, the whole job is stubs. that's the vibe.
β¨ SYNOPSIS β¨
llvm-ifs [options] inputs
that's it. options first, then your inputs. slay.
β¨ DESCRIPTION β¨
so here's the tea: llvm-ifs is a tool that jointly produces two things for shared objects β and by "jointly" i mean it does both, together, in one go:
- human readable, text-based stubs (
.ifsfiles) for shared objects π - linkable shared object stubs (
.sofiles) π₯
and it makes them from either ELF shared objects or text-based stubs. either direction, she's flexible.
ngl the text-based stubs are the main character here β they're useful for monitoring ABI changes of the shared object. like a little watchdog for your ABI. π
and the linkable shared object stubs? those are for avoiding unnecessary relinks when the ABI of shared libraries does not change. no ABI change = no relink = we stay unbothered. β¨
π IFS FORMATS π
here's an example of the text representation (IFS) of a shared object, produced by llvm-ifs. look at her. gorgeous:
--- !ifs-v1
IFSVersion: 3.0
SoName: libtest.so /* Optional */
Target: x86_64-unknown-linux-gnu /* Optional, format 1, same format as llvm target triple */
Target: { Arch: x86_64, Endianness: little, Bitwidth: 64 } /* Optional, format 2 */
NeededLibs:
- libc.so.6
Symbols:
- { Name: sym0, Type: Notype }
- { Name: sym1, Type: Object, Size: 0 }
- { Name: sym2, Type: Func, Weak: false }
- { Name: sym3, Type: TLS }
- { Name: sym4, Type: Unknown, Warning: foo }
...
now let's break down every field, because iykyk:
IFSVersion: the version of the IFS file, for reader compatibility. so the reader knows what it's dealing with. πSoName(optional): the name of the shared object file that is being stubbed.Target(optional): the architecture, endianness and bitwise information of this shared object. it can be either in explicit format or in implicit LLVM triple format. it can be optional, and it can be overridden from command line options. flexible queen. π¦NeededLibs: the list of the external shared objects that this library depends on.Symbols: a collection of all data needed to link objects for each symbol, sorted by name in ascending order. and insideSymbolswe got the little sub-fields:Name: symbol name.Type: whether the symbol is an object, function, no-type, thread local storage, or unknown. and here's the cute part β symbol types that aren't explicitly supported are mapped as unknown to improve signal-to-noise ratio. she's keeping it clean. β¨Size: the size of the symbol in question. it doesn't apply to functions, and it's optional forNoTypesymbols.Undefined: whether or not the symbol is defined in this shared object file.Weak: whether or not the symbol should be treated as weak.Warning(optional): warning text to output when this symbol is linked against. β οΈ
and now the big picture, because this matters: this YAML based text format contains everything that is needed to generate a linkable ELF shared object as well as an Apple TAPI format file. everything. all of it. π«Ά
the ordering of symbols is sorted, so these files can be easily compared using diff tools. and if the content of the file changes, it indicates a potentially ABI breaking change. π₯ that's the whole point β diff it, spot the break, save your build.
π¦ ELF STUB FORMAT π¦
a minimum ELF file that can be used by a linker should have the following sections properly populated. every single one, bestie, no skipping:
- ELF header.
- Section headers.
- Dynamic symbol table (
.dynsymsection). - Dynamic string table (
.dynstrsection). - Dynamic table (
.dynamicsection), which contains:DT_SYMTABentry.DT_STRTABentry.DT_STRSZentry.DT_NEEDEDentries. (optional)DT_SONAMEentry. (optional)
- Section header string table (
.shstrtabsection)
β οΈ heads up: this ELF file may have compatibility issues with ELF analysis tools that rely on the program headers. but linkers like LLD work fine with such a minimum ELF file, without errors. so like, know your audience. π
β¨ OPTIONS β¨
okay here's every single flag, we're not leaving a single one behind π
--input-format=[IFS|ELF|OtherObjectFileFormats]β specify the input file format. currently, only text IFS files and ELF shared object files are supported. this flag is optional, since the input format can be inferred anyway. π§--output-elf=<output-filename>β specify the output file for the ELF shared object stub.--output-ifs=<output-filename>β specify the output file for the text IFS.--output-tbd=<output-filename>β specify the output file for the Apple TAPItbd.--arch=[x86_64|AArch64|...]β optional, and it should only be used when reading an IFS file which does not define the Arch (architecture). this flag defines the architecture of the output file, and can be any string supported by the ELFe_machinefield. if the value conflicts with the IFS file, an error will be reported and the program will stop. π--endianness=[little|big]β optional, and it should only be used when reading an IFS file which does not define the Endianness. this flag defines the endianness of the output file. if the value conflicts with the IFS file, an error will be reported and the program will stop.--bitwidth=[32|64]β optional, and it should only be used when reading an IFS file which does not define the BitWidth. this flag defines the bit width of the output file. if the value conflicts with the input IFS file, an error will be reported and the program will stop.--target=<target triple>β optional, and should only be used when reading an IFS file which does not define any target information. this flag defines the architecture, endianness and bit width of the output file using an llvm target triple. π― this flag cannot be used simultaneously with other target related flags. pick a lane.--hint-ifs-target=<target triple>β optional, and should only be used when reading an ELF shared object and generating an IFS file. by default,llvm-ifswill use theArch,EndiannessandBitWidthfields to reflect the target information from the input object file. using this flag tellsllvm-ifsthe expected target triple in the output IFS file. if the value matches the target information from the object file, this value will be used in theTarget:field in the generated IFS. if it conflicts with the input object file, an error will be reported and the program will stop. π--hint-ifs-targetβ optional, and should only be used when outputting an IFS file. this flag strips the Arch field from the IFS file so it can be overridden later. πΈ--strip-ifs-endiannessβ optional, and should only be used when outputting an IFS file. this flag strips the Endianness field from the IFS file so it can be overridden later.--strip-ifs-bitwidthβ optional, and should only be used when outputting an IFS file. this flag strips the BitWidth field from the IFS file so it can be overridden later.--strip-ifs-targetβ optional, and should only be used when outputting an IFS file. this flag strips the Target field from the IFS file so it can be overridden later.--write-if-changedβ when this flag is set,llvm-ifswill only write the output file if it does not already exist, or if the content will be different from the existing file. no pointless writes, we respect the filesystem. π--strip-sizeβ when this flag is set,llvm-ifswill remove the size field from the output IFS file. this is useful for shared objects that only intend to be linked against position independent code, which doesn't need copy relocations β or where the size of an object is not a useful part of the ABI to track. π₯
π EXIT STATUS π
if llvm-ifs succeeds, it will exit with 0. π otherwise, if an error occurs, it will exit with a non-zero value. that's it, that's the whole drama.
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). legends, honestly.
π COPYRIGHT π
2003-2023, LLVM Project. periodt.
and that's the whole page, bestie!! π no cap, you now know llvm-ifs better than most people who use it daily. mwah. π«Ά
sign-off szn: this page is page 15, dated 2023-01-14, from the LLVM manual collection β so like, when you cite her, cite her right. go forth and stub. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm15 15.0.7-160000.3.1 Β· 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