CLANG-EXTRACT(1)
π CLANG-EXTRACT π
okay bestie, so clang-extract is a Tool to extract code content from source files using clang and LLVM infrastructure. that's the whole vibe. let's get into it β¨
πΈ SYNOPSIS πΈ
clang-extract [options] file...
π¦ DESCRIPTION π¦
OVERVIEW: Tool to extract code from C projects using the LLVM infrastructure.
the way that it needs to be invoked: it's literally a C compiler bestie. invoke it as one. no cap.
USAGE: clang-extract [options] file...
β¨ CLANG-EXTRACT OPTIONS: β¨
<clang-switch>β bestie this is just a clang switch, exactly like the ones you'd find by callingclang --help. nothing new here, it's giving au naturel π-D__KERNEL__β tells clang-extract that we're processing a Linux sourcefile. yes that's double-underscore KERNEL double-underscore, iconic as always π-DCE_EXTRACT_FUNCTIONS=<args>β extract the functions that you listed in the<args>list. this is the main character directive fr fr π-DCE_EXPORT_SYMBOLS=<args>β force externalization of the symbols you put in the<args>list. no hiding, they're going public π«-DCE_OUTPUT_FILE=<arg>β outputs the code into the<arg>file. default is<input>.CE.c, which honestly is such a cute default π-DCE_NO_EXTERNALIZATIONβ disable symbol externalization. periodt π-DCE_DUMP_PASSESβ dump the results of each transformation pass into files. yes queen, spill the tea on every pass π«-DCE_KEEP_INCLUDESβ keep all possible#include<file>directives. don't touch them, they're precious π-DCE_KEEP_INCLUDES=<policy>β keep all possible#include<file>directives, but using the specified include expansion<policy>. the valid values arenothing,everything,kernel,systemandcompiler. pick your fighter π-DCE_EXPAND_INCLUDES=<args>β force expansion of the headers provided in<args>. yep, make them grow π±-DCE_NOT_EXPAND_INCLUDES=<args>β force the headers listed in<args>to NOT be expanded. leave them alone π-DCE_RENAME_SYMBOLSβ allow renaming of extracted symbols. new name, new era β¨-DCE_DEBUGINFO_PATH=<arg>β path to the compiled (ELF) object of the desired program to extract. this is what decides whether externalization is necessary or not for a given symbol. it's the vibe check for symbols π-DCE_IPACLONES_PATH=<arg>β path to.ipa-clonesfiles generated by gcc. used to decide if the desired function to extract was inlined into other functions. sneaky inlining, always π΅οΈ-DCE_SYMVERS_PATH=<arg>β path to the kernelModules.symversfile. only used when-D__KERNEL__is specified. conditional queen π-DCE_DSC_OUTPUT=<arg>β Libpulp.dscfile output, used for userspace livepatching. hot-patching but make it userspace π₯-DCE_OUTPUT_FUNCTION_PROTOTYPE_HEADER=<arg>β outputs a header file with a forward declaration of all functions. heads up bestie: this header is not self-compilable. it's giving unfinished business π-DCE_LATE_EXTERNALIZEβ enable late externalization (declare externalized variables later than the original). may reduce code output when-DCE_KEEP_INCLUDESis enabled. fashionably late but it slays π-DCE_IGNORE_CLANG_ERRORSβ Ignore clang compilation errors in a hope that code is generated even if it won't compile. literally hoping for the best π no cap, that's the description.
π« THE IGNORED LIST π«
The following arguments are ignored by clang-extract. not ignored by us though, we see them, we list them, we love them π
-mpreferred-stack-boundary=-mindirect-branch=thunk-extern-mindirect-branch-register-mrecord-mcount-falign-jumps=-fasan-shadow-offset=-fconserve-stack-fdump-ipa-clones-flive-patching=inline-clone-fmin-function-alignment=16-fno-allow-store-data-races-fno-var-tracking-assignments-Wno-alloc-size-larger-than-Wno-dangling-pointer-Wno-format-truncation-Wno-format-overflow-Wmaybe-uninitialized-Wno-maybe-uninitialized-Wpacked-not-aligned-Wno-packed-not-aligned-Wno-restrict-Wno-stringop-overflow-Wstringop-truncation-Wno-stringop-truncation-Werror=designated-init-Wimplicit-fallthrough=-Wendif-labels-Wmissing-selector-name-Wfree-labels-Wmissing-parameter-name
π SEE MORE π
for a list of switches accepted by clang, run:
$ clang --help
this manpage was developed by Aryan Karamtoth for the Debian GNU/Linux System but can be used by other distributions. bestie really said "works on my distro, works on yours" π«Ά
and that's a wrap bestie! π this is clang-extract 1.0, dated May 2026. go extract something gorgeous π β¨π
π¦ where this page comes from
- ubuntu stonking: clang-extract 0.0~git20260224.ac30d66-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms