LLVM-EXTRACT(1)

πŸ’… LLVM-EXTRACT β€” okay bestie, let me put you on

So this is a page from the LLVM manual set β€” like, the LLVM-EXTRACT(1) one specifically, section 1, tools-and-commands territory. Sit down, grab a strawberry drink πŸ“, and let's get into it.

✨ NAME ✨

llvm-extract β€” literally just pulls one function out of an LLVM module. That's the whole vibe. 🫢

✨ SYNOPSIS ✨

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

✨ DESCRIPTION ✨

Okay so here's the tea β˜•: llvm-extract takes a function name and extracts it out of the LLVM bitcode file you point it at. Its main-character purpose in life? Debugging πŸ’€ β€” specifically shrinking big test cases down from larger programs that are triggering a bug. Think of it as the "reduce the noise until the bug is the only thing left" tool. Iconic behavior honestly.

And it doesn't stop at just the function β€” no cap, it will also remove unreachable global variables, prototypes, and unused types. Spring cleaning energy 🧹✨.

Where does it read from? Standard input, if filename is omitted or if filename is -. Ngl, that's convenient. And the output? Always goes to standard output β€” unless you use the -o option (peep below πŸ‘€).

✨ OPTIONS ✨

  • --alias alias-name β€” extracts the alias named function-name from the LLVM bitcode. You can pass it multiple times to extract multiple alias at once. πŸŽ€
  • --ralias alias-regular-expr β€” extracts the alias matching alias-regular-expr from the LLVM bitcode. Every alias that matches the regular expression gets extracted. May be specified multiple times.
  • --bb basic-block-specifier β€” extracts the basic block(s) named in basic-block-specifier. May be specified multiple times. Each <function:bb[;bb]> specifier pair will create a function. Heads up ⚠️: if you specify multiple basic blocks in one pair, the first block in the sequence should dominate the rest.
  • --delete β€” deletes specified Globals from Module. πŸ—‘οΈ
  • -f β€” enables binary output on terminals. Normally llvm-extract will refuse to write raw bitcode output if the output stream is a terminal. With this option, it'll write raw bitcode regardless of the output device. (Lowkey a "commit to it" flag πŸ’€)
  • --func function-name β€” extracts the function named function-name from the LLVM bitcode. May be specified multiple times to extract multiple functions at once. This is the one your synopsis is obsessed with.
  • --rfunc function-regular-expr β€” extracts 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 β€” extracts 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 β€” extracts 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 β€” preserves the values of constant globals. 🫢 don't lose the data bestie
  • --recursive β€” recursively extracts all called functions. It's giving "and bring your friends" energy 🌈
  • -help β€” prints a summary of command line options.
  • -o filename β€” specifies the output filename. If filename is - (the default), then llvm-extract sends its output to standard output. 🎯
  • -S β€” writes output in LLVM intermediate language (instead of bitcode). Honestly the more readable option, iykyk.

✨ EXIT STATUS ✨

If llvm-extract succeeds, it exits with 0. Slay. πŸ’– Otherwise, if an error occurs, it exits with a non-zero value. 😭

✨ SEE ALSO ✨

  • bugpoint(1) <bugpoint.html> β€” go say hi, it's in the same friend group πŸ¦‹

✨ Author ✨

Maintained by the LLVM Team (https://llvm.org/). Kings πŸ‘‘

2003-2026, LLVM Project


That's the whole page, no crumbs left behind. Every flag, every path, every default preserved πŸ’…

Okay that's a wrap bestie β€” this one's straight from the LLVM corner of the manual set, dated 2026-05-15, page 21 energy, and you absolutely ate that read-through. πŸŽ€βœ¨πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from