linux_testing: enable Rust by default for aarch64-linux

The first assumption[1] we had was that the `aarch64-unknown-none`
target was missing from rustc and that this was the cause for the
regression.

However, it turns out that the relevant code from `rustc` wasn't used
anyways because the Makefile does `--sysroot /dev/null`[2] which prevents
rustc from using its own libcore. So luckily we don't have to patch the
Rust bootstrap to get aarch64-linux back working[3].

In fact, the Rust part seems broken for both 6.10 and 6.11[4], but I
decided to not bother since none of those are longterm versions.

So all that's left here is to enable Rust for aarch64-linux because it
clearly works[5].

[1] https://github.com/NixOS/nixpkgs/pull/315121#issuecomment-2135805876
[2] https://lore.kernel.org/all/20231031201752.1189213-1-mmaurer@google.com/
[3] Of course I only realized this _after_ I spent some time hacking a rustc
    patch together 🙃
[4] This broke with

        error[E0463]: can't find crate for `core`
          |
          = note: the `aarch64-unknown-none` target may not be installed
          = help: consider downloading the target with `rustup target add aarch64-unknown-none`
          = help: consider building the standard library from source with `cargo build -Zbuild-std`

[5] While the build is fine, the VM tests are still panicking, but
    that's also the case for `kernel-generic` because of a 9p
    regression:

        switch_root: can't execute '/nix/store/zv87gw0yxfsslq0mcc35a99k54da9a4z-nixos-system-machine-test/init': Exec format error
        [    1.734997] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100
        [    1.736002] CPU: 0 UID: 0 PID: 1 Comm: switch_root Not tainted 6.12.0-rc1 #1-NixOS
        [...]

    Reported as https://lore.kernel.org/all/D4LHHUNLG79Y.12PI0X6BEHRHW@mbosch.me/T/#u
This commit is contained in:
Maximilian Bosch 2024-10-12 16:41:54 +02:00 committed by Alyssa Ross
parent 4433a315bd
commit 3bf9c88c1d

View File

@ -33,10 +33,8 @@ let
kernelSupportsRust = lib.versionAtLeast version "6.7"; kernelSupportsRust = lib.versionAtLeast version "6.7";
# Currently only enabling Rust by default on kernel 6.12+, # Currently only enabling Rust by default on kernel 6.12+,
# which actually has features that use Rust that we want, # which actually has features that use Rust that we want.
# and only on x86_64, because of a nixpkgs rustc issue: defaultRust = lib.versionAtLeast version "6.12" && (stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isAarch64);
# https://github.com/NixOS/nixpkgs/pull/315121#issuecomment-2135805876
defaultRust = lib.versionAtLeast version "6.12" && stdenv.hostPlatform.isx86_64;
withRust = (forceRust || defaultRust) && kernelSupportsRust; withRust = (forceRust || defaultRust) && kernelSupportsRust;
options = { options = {