LLVM-EXTRACT(1)

πŸ’… LLVM-EXTRACT β€” bestie edition

okay so you found llvm-extract, from the LLVM manual set, and honestly? she's a little legend. let's get into it 🫢


✨ NAME ✨

llvm-extract β€” extract a function from an LLVM module. that's it. that's the whole job. iconic. πŸ‘‘


🌸 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 from the LLVM bitcode file you point it at.

her main character era is being a debugging tool β€” you use her to shrink down test cases from bigger programs that are triggering a bug. like, your giant codebase is being messy, she takes the one function that's causing drama and gives you just that. slay. πŸ’…

and she's not just grabbing the function's bitcode, no ma'am. she also removes unreachable global variables, prototypes, and unused types. cleanup queen fr fr.

where does she read from? she reads her input from standard input if filename is omitted, or if filename is -. and the output? always written to standard output, unless you pass the -o option (see below, bestie, it's right there).


πŸ’– OPTIONS πŸ’–

  • –alias alias-name β€” extract the alias named function-name from the LLVM bitcode. can be specified multiple times to extract multiple alias at once, bc why settle for one.
  • –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. 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. and listen: if multiple basic blocks are specified in one pair, the first block in the sequence should dominate the rest. important. remember it. πŸŽ€
  • –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 said "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 one, the moment, the icon ⭐
  • –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 touch them. they're fine. 🧚
  • –recursive β€” recursively extract all called functions. she goes deep. πŸŒ€
  • -help β€” print a summary of command line options. we love a helpful queen.
  • -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. and honestly? same, bestie. 😭


⭐ SEE ALSO ⭐


πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). yes, the whole team. they said "we got this". πŸ’œ


2003-2025, LLVM Project


okay that's the whole page, no cap. this one shipped as LLVM manual version 14, dated 2025-05-22 β€” and that's the vibe check, we're done here. go extract something and eat, bestie πŸ’–βœ¨

πŸ“¦ where this page comes from