LLVM-IFS(1)
π LLVM-IFS π
okay so bestie, welcome to llvm-ifs β the shared object stubbing tool from the LLVM manual (that's the LLVM part of the header, iykyk). she's a command-line girlie and honestly? iconic.
llvm-ifs [options] inputs
β¨ DESCRIPTION β¨
llvm-ifs is a tool that jointly produces human readable text-based stubs (.ifs files) for shared objects and linkable shared object stubs (.so files), from either ELF shared objects or text-based stubs. no cap.
the text-based stubs are useful for monitoring ABI changes of the shared object. and the linkable shared object stubs? they can be used to avoid unnecessary relinks when the ABI of shared libraries does not change. slay, honestly.
π IFS FORMATS π
here's an example of the text representation (IFS) of a shared object produced by llvm-ifs β and yes you're gonna want to screenshot this:
--- !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 }
...
okay let's break down every single field, because the details are the moment:
IFSVersionβ version of the IFS file for reader compatibility. basically the vibe check number.SoName(optional) β 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 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 inside each symbol:Nameβ symbol name.Typeβ whether the symbol is an object, function, no-type, thread local storage, or unknown. symbol types not explicitly supported are mapped as unknown to improve signal-to-noise ratio. (lmk if that's not the whole story, because that's literally all the manual says π«Ά)Sizeβ the size of the symbol in question. doesn't apply to functions, and is 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.
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. 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. π so like, diff it, bestie.
π¦ ELF STUB FORMAT π¦
a minimum ELF file that can be used by linker should have the following sections properly populated β no skipping, this is the whole list:
- ELF header.
- Section headers.
- Dynamic symbol table (
.dynsymsection). - Dynamic string table (
.dynstrsection). - Dynamic table (
.dynamicsection).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. linkers like LLD work fine with such a minimum ELF file without errors. so likeβ¦ know your audience, okay?
π OPTIONS π
--input-format=[IFS|ELF|OtherObjectFileFormats]β specify input file format. currently, only text IFS files and ELF shared object files are supported. this flag is optional as the input format can be inferred. she's perceptive like that.--output-elf=<output-filename>β specify the output file for ELF shared object stub.--output-ifs=<output-filename>β specify the output file for text IFS.--output-tbd=<output-filename>β specify the output file for Apple TAPItbd.--arch=[x86_64|AArch64|...]β this flag is 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 ELFe_machinefield. if the value is conflicting with the IFS file, an error will be reported and the program will stop. no quiet drama, just an error.--endianness=[little|big]β this flag is 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 is conflicting with the IFS file, an error will be reported and the program will stop.--bitwidth=[32|64]β this flag is 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 is conflicting with the input IFS file, an error will be reported and the program will stop.--target=<target triple>β this flag is optional and should only be used when reading an IFS file which does not define any target information. this flag defines architecture, endianness and bit width of the output file using llvm target triple. this flag cannot be used simultaneously with other target related flags. pick a lane, bestie.--hint-ifs-target=<target triple>β this flag is optional and should only be used when reading an ELF shared object and generating an IFS file. by default,llvm-ifswill use '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:'filed 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β this flag is 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β this flag is 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β this flag is 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β this flag is 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. considerate icon behavior, honestly.--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. very straightforward, very demure.
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). periodt.
π COPYRIGHT π
2003-2023, LLVM Project. that's the whole copyright line, don't come for me.
okay that's the whole page bestie, every flag and field accounted for π«Ά this manual page is LLVM-IFS(1) from the LLVM manual, dated 2023-12-01, and it's giving "reference doc but make it cute" π
β¨ππ¦πΈπ
π¦ where this page comes from
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-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