Commit 8851e27d authored by Miguel Ojeda's avatar Miguel Ojeda
Browse files

rust: support Rust >= 1.91.0 target spec

Starting with Rust 1.91.0 (expected 2025-10-30), the target spec format
has changed the type of the `target-pointer-width` key from string
to integer [1].

Thus conditionally use one or the other depending on the version.

Cc: Waffle Maybe <waffle.lapkin@gmail.com>
Link: https://github.com/rust-lang/rust/pull/144443 [1]
Link: https://lore.kernel.org/r/20250829195525.721664-1-ojeda@kernel.org


Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent c09461a0
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -225,7 +225,11 @@ fn main() {
        ts.push("features", features);
        ts.push("llvm-target", "x86_64-linux-gnu");
        ts.push("supported-sanitizers", ["kcfi", "kernel-address"]);
        if cfg.rustc_version_atleast(1, 91, 0) {
            ts.push("target-pointer-width", 64);
        } else {
            ts.push("target-pointer-width", "64");
        }
    } else if cfg.has("X86_32") {
        // This only works on UML, as i386 otherwise needs regparm support in rustc
        if !cfg.has("UML") {
@@ -245,7 +249,11 @@ fn main() {
        }
        ts.push("features", features);
        ts.push("llvm-target", "i386-unknown-linux-gnu");
        if cfg.rustc_version_atleast(1, 91, 0) {
            ts.push("target-pointer-width", 32);
        } else {
            ts.push("target-pointer-width", "32");
        }
    } else if cfg.has("LOONGARCH") {
        panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
    } else {