Writing

Alchemist LLVM and Toolchain: Building Clang 24 for Android Kernels

1 min read

Kernel compilation on modern Android GKI targets moves fast. Alchemist LLVM and Alchemist-Toolchain exist so Android kernel and ROM builders can test bleeding-edge LLVM optimizations without waiting months for downstream prebuilts.

From AOSP Clang syncs to Clang 24

The Alchemist-LLVM repository maintains versioned branches from clang-21 through the latest clang-24 branch:

  • clang-24: Synced directly with upstream Google LLVM main (v24.0.0-rc1), bringing the latest VPlan, MLIR, and DAGCombiner fixes to kernel testing.
  • clang-23 & clang-21: Track upstream Google AOSP Clang milestones (r614150 for v23.0.1 and r574158 for v21.0.0) for predictable production builds.

Automated builds in Alchemist-Toolchain

Compiler source alone is only half the story. Alchemist-Toolchain builds on ClangBuiltLinux/tc-build with build-llvm.py, build-binutils.py, and our wrapper build-tc.sh:

bash
# Build LLVM Clang with MLGO enabled and automated Telegram reporting
ENABLE_MLGO=1 ./build-tc.sh 24

Recent updates hardened script integrity and retry logic, fixed absolute path handling for sanitize_aot_header in MLGO TensorFlow CMake builds, and stripped unnecessary LLVM docs and test suites so kernel toolchains compile faster and cleaner.

Explore both repositories at Alchemist-LLVM and Alchemist-Toolchain.

Confirm