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 π
βaliasalias-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.β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. 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. 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-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. she said "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 one, the moment, the icon ββ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 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.-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, 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". π
π COPYRIGHT π
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
- ubuntu questing: llvm-14 1:14.0.6-20ubuntu3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms