LLVM-EXTRACT(1)

πŸ“¦ version 23.1.3, in centos-stream 9

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

okay so this is from the LLVM manual set β€” yeah, that LLVM β€” and it's the llvm-extract command. buckle up, she's a debugging icon ✨

🌸 NAME 🌸

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

πŸŽ€ SYNOPSIS πŸŽ€

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so the llvm-extract command takes the name of a function and extracts it from the LLVM bitcode file you point it at. it's mainly a debugging tool, like literally its whole job is reducing test cases from bigger programs that are out here triggering a bug 😭 so you go from "huge messy program" to "tiny little reproducer" and honestly? slay.

and it's not just yoinking the one function β€” in addition to extracting the bitcode of the specified function, llvm-extract will also remove unreachable global variables, prototypes, and unused types. spring cleaning vibes 🧹✨

where does it read from? the llvm-extract command reads its input from standard input if filename is omitted, or if filename is -. and the output is always written to standard output β€” unless you use the -o option (see below, bestie, 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 alias at once.
  • --ralias alias-regular-expr β€” extract the alias matching alias-regular-expr from the LLVM bitcode. every alias matching the regular expression gets extracted πŸ’– may be specified multiple times.
  • --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 β€” no cap, that's the rule.
  • --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 😀 but with this option, llvm-extract will write raw bitcode regardless of the output device. it's giving "i do what i want".
  • --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 main character option fr.
  • --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 got).
  • --recursive β€” recursively extract all called functions πŸ” like following the whole friend group, iykyk.
  • -help β€” print a summary of command line options 🫢
  • -o filename β€” specify the output filename. if filename is - (the default), then llvm-extract sends its output to standard output πŸ’…
  • -S β€” write output in LLVM intermediate language (instead of bitcode) πŸ“

⭐ 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, she's not subtle.

πŸ‘€ SEE ALSO πŸ‘€

llvm-reduce(1)

🧚 AUTHOR 🧚

maintained by the LLVM Team β€” https://llvm.org/ β€” iconic behavior honestly πŸ’–

2003-2026, LLVM Project


and that's the whole page bestie πŸŽ€ written up on 2026-10-06, tagged as doc source 23 for LLVM β€” go extract something cute, and remember: -o exists so you don't have to raw-dog your terminal πŸ’…βœ¨

πŸ“¦ where this page comes from