LLVM-IFS(1)
π NAME π
okay bestie, meet llvm-ifs β the shared object stubbing tool π. This is the LLVM-IFS(1) page and she is lowkey iconic, no cap. If you've ever needed to keep an eye on whether your shared library's ABI is behaving or doing the absolute most, this is the girly for you. β¨
π¦ SYNOPSIS π¦
llvm-ifs [options] inputs
π DESCRIPTION π
so what does llvm-ifs actually do, you ask? she's a multitasker, periodt. She jointly produces human readable text-based stubs (the .ifs files) for shared objects and linkable shared object stubs (the .so files) β and she can do it starting from either ELF shared objects or from text-based stubs. she does both at once, like the main character she is π
The text-based stubs? literally perfect for monitoring ABI changes of the shared object. And the linkable shared object stubs? they're the ones that let you avoid unnecessary relinks when the ABI of shared libraries hasn't changed. no relink anxiety, we love that for us π«Ά
πΈ IFS FORMATS πΈ
here's an example of the text representation (IFS) of a shared object that llvm-ifs produced β study her, she's 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 }
...
and now the field-by-field breakdown, because we're thorough in this house π:
- IFSVersion β the version of the IFS file, so the reader knows what it's dealing with (reader compatibility, bestie).
- SoName (optional) β the name of the shared object file that's 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's optional and it can be overridden from command line options. so flexible of her π
- NeededLibs β the list of the external shared objects that this library depends on. her little support system π₯Ί
- Symbols β a collection of all data needed to link objects for each symbol, sorted by name in ascending order. β¨ and inside each one:
- Name β symbol name.
- Type β whether the symbol is an object, function, no-type, thread local storage, or unknown. symbol types that aren't explicitly supported get mapped as unknown to improve the signal-to-noise ratio. we love a clean signal π₯
- Size β the size of the symbol in question. doesn't apply to functions, and it's optional for
NoTypesymbols. - 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. spooky but useful π
This YAML based text format contains everything that's needed to generate a linkable ELF shared object as well as an Apple TAPI format file. And because the ordering of symbols is sorted, these files can be easily compared using diff tools. π
so if the content of the file changes, that indicates a potentially ABI breaking change. likeβ¦ pay attention bestie, that's the whole point. π¨
π ELF STUB FORMAT π
A minimum ELF file that can be used by a linker should have the following sections properly populated β no skipping, we're doing all of them:
- ELF header.
- Section headers.
- Dynamic symbol table (the
.dynsymsection). - Dynamic string table (the
.dynstrsection). - Dynamic table (the
.dynamicsection), which contains:DT_SYMTABentry.DT_STRTABentry.DT_STRSZentry.DT_NEEDEDentries. (optional)DT_SONAMEentry. (optional)
- Section header string table (the
.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, no errors, no drama. π§
β¨ OPTIONS β¨
--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 because the input format can be inferred. she'll figure it out herself, she's smart like that π--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 TAPI tbd.--arch=[x86_64|AArch64|...]β optional, and it should only be used when you're reading an IFS file that doesn't define the Arch (architecture). this flag defines the architecture of the output file, and it can be any string supported by the ELFe_machinefield. If the value is conflicting 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 that doesn't define the Endianness. this flag defines the endianness of the output file. If the value is conflicting 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 that doesn't define the BitWidth. this flag defines the bit width of the output file. If the value is conflicting 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 that doesn't define any target information. this flag defines 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, bestie π--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 the 'Arch, Endianness and BitWidth' fields to reflect the target information from the input object file. Using this flag will tellllvm-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 the 'Target:' 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 the content will be different from the existing file. so considerate, she's not gonna touch your files for no reason π₯°--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, she exits with 0 β¨. Otherwise, if an error occurs, she exits with a non-zero value. it's giving "we don't do silent failures in this house."
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/). π«Ά
π COPYRIGHT π
2003-2024, LLVM Project
and that's the whole page, bestie! π this little love letter comes to you from the LLVM source, version dated 2024-04-14, and it's the LLVM-IFS(1) manual. go stub something gorgeous, you've got this ππ
π
π¦ 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