LLVM-EXTRACT(1)
π
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 β¨
--aliasalias-name β extract the alias named function-name from the LLVM bitcode π you can pass this multiple times to extract multiple alias at once.--raliasalias-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.--bbbasic-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-extractwill refuse to write raw bitcode output if the output stream is a terminal π€ but with this option,llvm-extractwill write raw bitcode regardless of the output device. it's giving "i do what i want".--funcfunction-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.--rfuncfunction-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.--globglobal-name β extract the global variable named global-name from the LLVM bitcode π may be specified multiple times to extract multiple global variables at once.--rglobglob-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 π«Ά-ofilename β specify the output filename. if filename is-(the default), thenllvm-extractsends 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 π
π§ AUTHOR π§
maintained by the LLVM Team β https://llvm.org/ β iconic behavior honestly π
πΈ COPYRIGHT πΈ
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
- centos-stream 9: llvm 23.1.3-1.el9 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- centos-stream 9: llvm 23.1.3-1.el9 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms