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 β¨
--aliasalias-name β extracts the alias named function-name from the LLVM bitcode. You can pass it multiple times to extract multiple alias at once. π--raliasalias-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.--bbbasic-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. Normallyllvm-extractwill 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 π)--funcfunction-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.--rfuncfunction-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.--globglobal-name β extracts 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 β 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.-ofilename β specifies the output filename. If filename is-(the default), thenllvm-extractsends 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 π
β¨ Copyright β¨
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
- fedora 44: llvm21 21.1.8-5.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm21 21.1.8-5.fc44 Β· 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