CLANG-EXTRACT(1)

πŸ“¦ version 0.0~git20260224.ac30d66, in ubuntu stonking

πŸ’… 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 calling clang --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 are nothing, everything, kernel, system and compiler. 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-clones files 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 kernel Modules.symvers file. only used when -D__KERNEL__ is specified. conditional queen πŸ’œ
  • -DCE_DSC_OUTPUT=<arg> β€” Libpulp .dsc file 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_INCLUDES is 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