LLVM-TLI-CHECKER(1)

πŸ“¦ version 15.0.7, in opensuse-leap 16.0

πŸ’… LLVM-TLI-CHECKER β€” the TargetLibraryInfo vs. library checker, bestie edition πŸ’…

okay so this is llvm-tli-checker, from the LLVM squad (it's an LLVM manual page, iykyk) β€” and it's literally the tool that catches the compiler telling lies about your libraries. grab a strawberry πŸ“ and let's get into it.


✨ NAME ✨

llvm-tli-checker β€” TargetLibraryInfo vs library checker. that's the whole vibe: TLI vs. ur actual library files, in a head-to-head.

πŸŽ€ SYNOPSIS πŸŽ€

llvm-tli-checker [options] [library-file...]

πŸ¦‹ DESCRIPTION πŸ¦‹

so what it does: llvm-tli-checker takes TargetLibraryInfo's opinion about whether library functions are available, and compares it against the set of functions actually exported by the library files you point it at. then it reports every disagreement between what TLI thinks and whether the function is genuinely present. 🫢

this is highkey for vendors β€” the people who need to make sure the TLI for their target is correct, so the compiler doesn't "optimize" some code sequence into a library call that is not actually available. like imagine the compiler being that confident and that wrong. πŸ’€


πŸ”₯ EXAMPLE πŸ”₯

$ llvm-tli-checker --triple x86_64-scei-ps4 example.so
TLI knows 466 symbols, 235 available for 'x86_64-scei-ps4'

Looking for symbols in 'example.so'
Found 235 global function symbols in 'example.so'
Found a grand total of 235 library symbols
<< TLI yes SDK no:  '_ZdaPv' aka operator delete[](void*)
>> TLI no  SDK yes: '_ZdaPvj' aka operator delete[](void*, unsigned int)
<< Total TLI yes SDK no:  1
>> Total TLI no  SDK yes: 1
== Total TLI yes SDK yes: 234
FAIL: LLVM TLI doesn't match SDK libraries.

the << is "TLI said yes, SDK said no", the >> is "TLI said no, SDK said yes", and == is the sweet spot where everybody agrees. 234 out of 235 matching and it still says FAIL, because one disagreement is one too many. iconic behavior honestly. πŸ‘‘


🌸 OPTIONS 🌸

  • --dump-tli β€” prints "available" / "not available" for each library function, based on TargetLibraryInfo's info for the triple you specified, then dips out (exits). and no, it does not read any input files. this one's just for looking. πŸ™ˆ
  • --help, -h β€” prints a summary of the command line options and exits. classic.
  • --libdir=<directory> β€” a base directory that gets prepended to each library file path. super handy when you've got a bunch of library files all chillin' in the same directory, or when a list of input filenames is being kept in a response file. πŸŽ€
  • --report=<level> β€” how much tea gets spilled. <level> can be summary, discrepancy, or full:
    • summary gives you only the count of matching and mis-matching symbols
    • discrepancy lists the mis-matching symbols
    • full lists all symbols known to TLI, matching or mis-matching
    • the default is discrepancy.
  • --separate β€” reads and reports a summary for each library file separately. this is useful for identifying library files that don't contribute anything that TLI knows about. it implies --report=summary (and yes, that can be overridden). πŸ’œ
  • --triple=<triple> β€” the triple to use for initializing TargetLibraryInfo. that's it, that's the one.
  • @<FILE> β€” reads command-line options and/or library names from the response file <FILE>. 🧚

⭐ EXIT STATUS ⭐

llvm-tli-checker returns 0 even if there are mismatches β€” yeah, it's chill like that. it returns a non-zero exit code if there is an unrecognized option, or if no input files are provided. so it'll forgive a wrong library but not a wrong flag. πŸ’…

fr fr β€” mismatches are NOT a failure exit. don't script around exit codes expecting them to catch discrepancies, because they won't. read the report instead. πŸ‘€

πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). we stan. 🫢

2003-2023, LLVM Project


and that's the whole page, bestie β€” no cap, every flag accounted for. this gem is from the LLVM Project, version/date situation being 15 and 2023-01-14 (dropped in LLVM-TLI-CHECKER(1) style, as one does). go check ur TLI, slay, and remember: the compiler does not get to invent library calls. periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from