LLVM-EXTRACT(1)

πŸ“¦
version 13.0.1 Β· 5 versions
, in ubuntu jammy

πŸ’… LLVM-EXTRACT(1) β€” the llvm-extract manual page, bestie edition

okay so real talk, this is the manual page for llvm-extract, and it's genuinely one of the most useful little gremlin tools in the whole LLVM suite. sit down, grab a boba, we're gonna get into it πŸ§‹βœ¨


✨ NAME ✨

llvm-extract β€” extract a function from an LLVM module 🫢


πŸŽ€ SYNOPSIS πŸŽ€

llvm-extract [options] –func function-name [filename]

that's the whole vibe. one flag, one name, optional file. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

so the llvm-extract command takes the name of a function and extracts it out of the LLVM bitcode file you point it at. it's primarily used as a debugging tool, and honestly that's its main character era: it's how you reduce test cases from bigger programs that are out here triggering a bug. like, "this 40,000-line monster crashes the compiler" β†’ "here's the 12-line repro, you're welcome" πŸ’…

and it doesn't just grab the function's bitcode and dip. in addition to extracting the bitcode of the specified function, llvm-extract will also remove unreachable global variables, prototypes, and unused types. so the output is clean-clean. it's giving "tidied my room before the photo". ✨

about input/output, listen up: llvm-extract reads its input from standard input if filename is omitted or if filename is -. the output is always written to standard output, unless you pass the -o option (see below, it's down there, I gotchu). 🫢


🌸 OPTIONS 🌸

here's the whole roster, no skips, no summarising, every single one gets its moment:

  • –alias alias-name β€” extract the alias named function-name from the LLVM bitcode. yeah, the manual literally says function-name here, I'm not fixing it, I'm just the messenger 😭. may be specified multiple times to extract multiple alias at once.
  • –ralias alias-regular-expr β€” extract the alias matching alias-regular-expr from the LLVM bitcode. all alias matching the regular expression will be extracted. may be specified multiple times. regex girlies rise 🧚
  • –bb basic-block-specifier β€” extract basic block(s) specified in basic-block-specifier. may be specified multiple times. each <function:bb[;bb]> specifier pair will create a function. if multiple basic blocks are specified in one pair, the first block in the sequence should dominate the rest β€” that's a real constraint, don't fight it, the verifier will win πŸ’€
  • –delete β€” delete specified Globals from Module. that's it, that's the whole description. short king πŸ‘‘
  • -f β€” enable binary output on terminals. normally llvm-extract will refuse to write raw bitcode output if the output stream is a terminal. with this option, llvm-extract will write raw bitcode regardless of the output device. so like... it's the "yes I know I'm piping binary into my terminal, I'm built different" flag πŸ™ˆ
  • –func function-name β€” extract the function named function-name from the LLVM bitcode. may be specified multiple times to extract multiple functions at once. the classic. the blueprint. πŸ”₯
  • –rfunc function-regular-expr β€” extract the function(s) matching function-regular-expr from the LLVM bitcode. all functions matching the regular expression will be extracted. may be specified multiple times.
  • –glob global-name β€” extract the global variable named global-name from the LLVM bitcode. may be specified multiple times to extract multiple global variables at once. globals wanna be extracted too, don't be a hater πŸ’œ
  • –rglob glob-regular-expr β€” extract the global variable(s) matching global-regular-expr from the LLVM bitcode. all global variables matching the regular expression will be extracted. may be specified multiple times. (yes the flag says rglob and the argument is called glob-regular-expr β€” that's canon, I don't make the rules πŸŽ€)
  • –keep-const-init β€” preserve the values of constant globals. don't let them get zeroed out into the void, protect them 🫢
  • –recursive β€” recursively extract all called functions. it's giving "you get a function, and you get a function, and you get a function" 🎁
  • -help β€” print a summary of command line options. when in doubt, ask the tool itself ✨
  • -o filename β€” specify the output filename. if filename is - (the default), then llvm-extract sends its output to standard output. so the default is literally just stdout, cute.
  • -S β€” write output in LLVM intermediate language (instead of bitcode). human-readable era 🌈
little heads-up bestie: -f is the difference between "nice refusal message" and "a wall of unreadable bytes in your terminal". that refusal is a feature. it is protecting you. 😭

⭐ EXIT STATUS ⭐

if llvm-extract succeeds, it will exit with 0. otherwise, if an error occurs, it will exit with a non-zero value. classic. zero is the good number, anything else means something went sideways. ngl that's the whole story.


🌟 SEE ALSO 🌟


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). absolute icons, no cap.


2003-2023, LLVM Project


and that's the page!! πŸ’… ok bye bestie β€” this was the llvm-extract manpage, straight from LLVM 13, dated 2023-07-14. go extract something iconic. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from