LLVM-EXTRACT(1)

πŸ’… LLVM-EXTRACT β€” the manual page, bestie edition πŸ’…

okay so this is llvm-extract from the LLVM manual set, and honestly? she's a little diva with one job and she does it flawlessly.


✨ NAME ✨

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


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea, bestie: llvm-extract takes the name of a function and extracts it out of the LLVM bitcode file you point it at. That's it. That's the whole vibe.

Her main character era is being a debugging tool β€” you use her to shrink a giant program down into a tiny little test case when something is triggering a bug. Think of it like ✨decluttering✨ but for bitcode. πŸ”₯

And she's not just grabbing the function and leaving, no no. She's thorough. On top of extracting the bitcode of the specified function, llvm-extract will also remove unreachable global variables, prototypes, and unused types. She cleans up after herself, periodt. πŸ§ΉπŸ’…

Where does she read from? If you omit filename, or if filename is -, she reads from standard input. And where does the output go? always to standard output β€” unless you use the -o option (more on that below, don't worry).


πŸŽ€ 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. (yes, multiple alias. she said what she said.)
  • --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.
  • --bb basic-block-specifier β€” extract basic blocks(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. (yes bestie, that's a rule, not a suggestion πŸ‘€)
  • --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. She's being brave for you. πŸ™ˆ
  • --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 girl the synopsis is talking about, iykyk)
  • --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.
  • --recursive β€” recursively extract all called functions. she goes deeper. πŸŒ€
  • -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, she exits with 0. Otherwise, if an error occurs, she exits with a non-zero value. Slay when it works, sad girl hours when it doesn't. 😭


πŸ”₯ SEE ALSO πŸ”₯

bugpoint(1)


πŸ’– AUTHOR πŸ’–

Maintained by the LLVM Team (<https://llvm.org/>). wait, no links allowed β€” okay, the address is literally just https://llvm.org/ bestie, go look it up. 🫢


2003-2025, LLVM Project


and that's the whole page!! ✨ this one came from the LLVM manual set, dated 2025-09-03, and it's page 20 of the LLVM-EXTRACT(1) lineup. go forth and extract, bestie, you've got this πŸ’…πŸ’–πŸŽ€

πŸ“¦ where this page comes from