LLVM-EXTRACT(1)
π
LLVM-EXTRACT(1) β the llvm-extract manual page, bestie edition
okay so real talk, this is the manual page for llvm-extract, and it's genuinely one of the most useful little gremlin tools in the whole LLVM suite. sit down, grab a boba, we're gonna get into it π§β¨
β¨ NAME β¨
llvm-extract β extract a function from an LLVM module π«Ά
π SYNOPSIS π
llvm-extract [options] βfunc function-name [filename]
that's the whole vibe. one flag, one name, optional file. slay.
π¦ DESCRIPTION π¦
so the llvm-extract command takes the name of a function and extracts it out of the LLVM bitcode file you point it at. it's primarily used as a debugging tool, and honestly that's its main character era: it's how you reduce test cases from bigger programs that are out here triggering a bug. like, "this 40,000-line monster crashes the compiler" β "here's the 12-line repro, you're welcome" π
and it doesn't just grab the function's bitcode and dip. in addition to extracting the bitcode of the specified function, llvm-extract will also remove unreachable global variables, prototypes, and unused types. so the output is clean-clean. it's giving "tidied my room before the photo". β¨
about input/output, listen up: llvm-extract reads its input from standard input if filename is omitted or if filename is -. the output is always written to standard output, unless you pass the -o option (see below, it's down there, I gotchu). π«Ά
πΈ OPTIONS πΈ
here's the whole roster, no skips, no summarising, every single one gets its moment:
βaliasalias-name β extract the alias named function-name from the LLVM bitcode. yeah, the manual literally says function-name here, I'm not fixing it, I'm just the messenger π. may be specified multiple times to extract multiple alias at once.βraliasalias-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. regex girlies rise π§β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 β that's a real constraint, don't fight it, the verifier will win πβdeleteβ delete specified Globals from Module. that's it, that's the whole description. short king π-fβ enable binary output on terminals. normallyllvm-extractwill refuse to write raw bitcode output if the output stream is a terminal. with this option,llvm-extractwill write raw bitcode regardless of the output device. so like... it's the "yes I know I'm piping binary into my terminal, I'm built different" flag πβfuncfunction-name β extract the function named function-name from the LLVM bitcode. may be specified multiple times to extract multiple functions at once. the classic. the blueprint. π₯β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. globals wanna be extracted too, don't be a hater πβ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. (yes the flag saysrgloband the argument is called glob-regular-expr β that's canon, I don't make the rules π)βkeep-const-initβ preserve the values of constant globals. don't let them get zeroed out into the void, protect them π«Άβrecursiveβ recursively extract all called functions. it's giving "you get a function, and you get a function, and you get a function" π-helpβ print a summary of command line options. when in doubt, ask the tool itself β¨-ofilename β specify the output filename. if filename is-(the default), thenllvm-extractsends its output to standard output. so the default is literally just stdout, cute.-Sβ write output in LLVM intermediate language (instead of bitcode). human-readable era π
little heads-up bestie: -f is the difference between "nice refusal message" and "a wall of unreadable bytes in your terminal". that refusal is a feature. it is protecting you. π
β EXIT STATUS β
if llvm-extract succeeds, it will exit with 0. otherwise, if an error occurs, it will exit with a non-zero value. classic. zero is the good number, anything else means something went sideways. ngl that's the whole story.
π SEE ALSO π
bugpoint(1)β go say hi to its sibling π¦
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). absolute icons, no cap.
π COPYRIGHT π
2003-2023, LLVM Project
and that's the page!! π
ok bye bestie β this was the llvm-extract manpage, straight from LLVM 13, dated 2023-07-14. go extract something iconic. periodt. πβ¨
π¦ where this page comes from
- ubuntu jammy: llvm-13 1:13.0.1-2ubuntu2.2 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms