Support several Rust toolchain versions
Andreas Hindborg
AppliedHi Miguel,
Quoted 26 lines · Miguel Ojeda
Hi all,
It is time to start supporting several Rust toolchain versions and thus establish a minimum Rust compiler and
bindgenversion.For the Rust compiler, we will start with a window of two stable releases, and widen it over time. This series keeps the minimum where it is (1.78.0), but adds support for the recently released 1.79.0.
This should already be enough for kernel developers in distributions that provide recent Rust compiler versions routinely, such as Arch Linux, Debian Unstable (outside the freeze period), Fedora Linux, Gentoo Linux (especially the testing channel), Nix (unstable) and openSUSE Tumbleweed. A documentation adds the instructions for each of them.
In addition, Rust for Linux is now being built-tested in Rust's pre-merge CI. That is, every change that is attempting to land into the Rust compiler is tested against the kernel, and it is merged only if it passes -- thanks to the Rust project for that!
Thus, with the pre-merge CI in place, both projects hope to avoid unintentional changes to Rust that break the kernel. This means that, in general, apart from intentional changes on their side (that we will need to workaround conditionally on our side), the upcoming Rust compiler versions should generally work.
Quoted 9 lines
For instance, currently, the beta (1.80.0) and nightly (1.81.0) branches work as well.
Similarly, we kept the minimum as it is for
bindgen.bindgenis also adding the kernel to its CI -- thanks!Cheers,
Miguel
Applied the series to [1], based on v6.9:
rustup override set --path ../rnull-v6.9-build 1.76.0 make O=../rnull-v6.9-build LLVM=1
Builds fine.
rustup override set --path ../rnull-v6.9-build 1.79.0 make O=../rnull-v6.9-build LLVM=1
make[1]: Entering directory '/home/aeh/src/linux-rust/rnull-v6.9-build'
GEN Makefile
mkdir -p /home/aeh/src/linux-rust/rnull-v6.9-build/tools/objtool && make O=/home/aeh/src/linux-rust/rnull-v6.9-build subdir=tools/objtool --no-print-directory -C objtool
CALL /home/aeh/src/linux-rust/rnull-v6.9/scripts/checksyscalls.sh
INSTALL libsubcmd_headers
RUSTC L rust/core.o
error: data-layout for target target-12379853866016577623, e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128, differs from LLVM target's x86_64-linux-gnu default layout, e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128
error: aborting due to 1 previous error
make[3]: *** [/home/aeh/src/linux-rust/rnull-v6.9/rust/Makefile:461: rust/core.o] Error 1 make[2]: *** [/home/aeh/src/linux-rust/rnull-v6.9/Makefile:1206: prepare] Error 2 make[1]: *** [/home/aeh/src/linux-rust/rnull-v6.9/Makefile:240: __sub-make] Error 2 make[1]: Leaving directory '/home/aeh/src/linux-rust/rnull-v6.9-build'
make: *** [Makefile:240: __sub-make] Error 2
error: Recipe lo failed with exit code 2
rm ../rnull-v6.9-build/rust
make O=../rnull-v6.9-build LLVM=1
same result.
rm ../rnull-v6.9-build/rust
<configure>
make O=../rnull-v6.9-build LLVM=1
same result.
Maybe because I am on v6.9?
Best regards,
Andreas
Quoted 2 lines · Andreas Hindborg
Maybe because I am on v6.9?
Yeah, you need https://lore.kernel.org/rust-for-linux/[email protected]/
-- please see the "## LLVM's data layout" section in the commit
message.
Thanks for giving it a try!
Cheers,
Miguel
Andreas Hindborg
Tested-byQuoted 7 lines · Miguel Ojeda
Quoted 2 lines · Andreas Hindborg
Maybe because I am on v6.9?
Yeah, you need https://lore.kernel.org/rust-for-linux/[email protected]/
-- please see the "## LLVM's data layout" section in the commit
message.
I applied it to the rnull tree based on v6.10-rc3 [1] and ran some tests with rustc 1.78.0 and 1.79.0 without encountering any problems.
Best regards,
Andreas