Slim LLVM toolchains with Rust for building the Linux kernel

These toolchains are the same slim LLVM toolchains from the directory above this one with versions of Rust added to them that Rust for Linux supports, depending on the Linux version. See the parent README for more information on the LLVM parts of the toolchain.

For certain trees, there may be two toolchains available to download with different LLVM versions. One will always be the latest stable version of the major version of LLVM that Rust uses under the hood (i.e., for Rust versions that use LLVM 17, there will always be one with LLVM 17.0.6 available). The other will be a matching version of LLVM that Rust uses under the hood (if it is not the latest version) so that features such as cross-language LTO that may have subtle issues without the same LLVM version can be experimented with. Rust does have out of tree patches for LLVM, which are applied to the Rust binaries (because they are official) but not the LLVM builds, which are from vanilla LLVM sources. If you do not know if you need matching LLVM versions, use the latest version, as there may be fixes relevant for the Linux kernel in LLVM stable releases.

Downloads

These toolchains are available for aarch64 and x86_64 machines. If you are unsure which one you have, run uname -m.

Toolchains with latest LLVM version

Tree Toolchain versions aarch64 x86_64
6.10 (mainline) LLVM 18.1.8, Rust 1.78.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.9 (stable) LLVM 17.0.6, Rust 1.76.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.8 (old stable) LLVM 17.0.6, Rust 1.74.1 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.6 (LTS) LLVM 17.0.6, Rust 1.73.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.1 (LTS) LLVM 14.0.6, Rust 1.62.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz

Toolchains with matching LLVM version

Tree Toolchain versions aarch64 x86_64
6.10 (mainline) LLVM 18.1.4, Rust 1.78.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.9 (stable) LLVM 17.0.6, Rust 1.76.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.8 (old stable) LLVM 17.0.4, Rust 1.74.1 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.6 (LTS) LLVM 17.0.2, Rust 1.73.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz
6.1 (LTS) LLVM 14.0.5, Rust 1.62.0 .tar.gz
.tar.xz
.tar.gz
.tar.xz

Past releases, checksums, and file sizes can be viewed under the files subdirectory.

Toolchains for unsupported kernel trees will eventually be removed. The "latest LLVM" toolchains will be periodically cleaned when new latest version toolchains are uploaded. Please save the toolchains locally if you want to rely on them.

Use

To use these toolchains, download and extract them somewhere on your hard drive using tar -axf. For the following examples, I will assume they are installed within the root of your kernel source.

From there, add the toolchain to PATH and set LIBCLANG_PATH to the full path to libclang.so so that bindgen can find it.

$ llvm_prefix=$PWD/llvm-17.0.6-rust-1.76.0-$(uname -m)

$ export PATH=$llvm_prefix/bin:$PATH

$ export LIBCLANG_PATH=$llvm_prefix/lib/libclang.so

$ cargo install --locked --root $llvm_prefix --version $(scripts/min-tool-version.sh bindgen) bindgen-cli

$ make LLVM=1 rustavailable
Rust is available!

For more information about building the Linux kernel with LLVM, please see the official documentation and the ClangBuiltLinux homepage. For more information about Rust for Linux, please see the official documentation and the Rust for Linux website.

Support

If you encounter an issue while using these toolchains, either open an issue on the Rust-for-Linux issue tracker or send an email to nathan@kernel.org, ojeda@kernel.org, and rust-for-linux@vger.kernel.org. Please include the kernel configuration you experience the issue with, the architecture you are building, and information about your distribution such as version.