LLVM-EXTRACT(1)

πŸ’– NAME πŸ’–

okay bestie, meet llvm-extract β€” it extracts a function from an LLVM module. that's the whole gig. it's giving "surgical little scalpel" energy πŸ”₯


✨ SYNOPSIS ✨

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way llvm-extract works is: you hand it a function name, and it pulls that function out of the LLVM bitcode file you point it at. that's it. slay. πŸ’…

its main character purpose is being a debugging tool β€” specifically, shrinking big test cases from big programs down to the tiny bit that's actually triggering a bug. like taking a 4-hour video and trimming it to the 3 seconds where the chaos happens. iconic behavior honestly.

and it doesn't stop at just the function, no ma'am. in addition to extracting the bitcode of the specified function, llvm-extract will also remove unreachable global variables, prototypes, and unused types. so it's a whole spring cleaning, not just a pluck-and-go 🧹✨

where does it read from? standard input, if filename is omitted or if filename is -. and the output always goes to standard output β€” unless you pass the -o option (peep below, it's right there) πŸ’–


πŸ‘‘ OPTIONS πŸ‘‘

  • --alias alias-name β€” extract the alias named function-name from the LLVM bitcode. you can pass this multiple times to extract multiple aliases at once. yes queen, stack 'em πŸŽ€
  • --ralias alias-regular-expr β€” extract the alias matching alias-regular-expr from the LLVM bitcode. all aliases matching the regular expression get extracted. may be specified multiple times.
  • --bb basic-block-specifier β€” extract the basic block(s) specified in basic-block-specifier. may be specified multiple times. each <function:bb[;bb]> specifier pair will create a function. lowkey important: if multiple basic blocks are specified in one pair, the first block in the sequence should dominate the rest.
  • --delete β€” delete specified Globals from Module.
  • -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. it's giving "no thoughts, just vibes" and honestly? valid πŸ™ˆ
  • --func function-name β€” extract the function named function-name from the LLVM bitcode. may be specified multiple times to extract multiple functions at once. this is the classic, the moment, the reason we're all here πŸ’œ
  • --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.
  • --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.
  • --keep-const-init β€” preserve the values of constant globals. don't let them get deleted, they're precious 🫢
  • --recursive β€” recursively extract all called functions. it brings the whole friend group along 🌈
  • -help β€” print a summary of command line options. when in doubt, ask the tool itself, bestie 😌
  • -o filename β€” specify the output filename. if filename is - (which is the default), then llvm-extract sends its output to standard output.
  • -S β€” write output in LLVM intermediate language (instead of bitcode). human-readable era ✨

πŸ’€ EXIT STATUS πŸ’€

if llvm-extract succeeds, it will exit with 0. otherwise, if an error occurs, it will exit with a non-zero value. no in-between, no "it's complicated", fr fr.


🌸 SEE ALSO 🌸

bugpoint(1) <bugpoint.html> β€” go read it, it's the cousin πŸ¦‹


πŸŽ€ AUTHOR πŸŽ€

maintained by the LLVM Team (https://llvm.org/). they're the blueprint, periodt.


2003-2026, LLVM Project


and that's the whole page, bestie!! this was the LLVM-EXTRACT(1) manual from the LLVM manual set, version 22, dated 2026-07-16. go extract something iconic πŸ’–βœ¨πŸŽ€πŸ¦‹πŸ’…
πŸ“¦ where this page comes from