aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Ojeda <[email protected]>2025-08-29 19:55:25 +0000
committerMiguel Ojeda <[email protected]>2025-08-31 21:34:34 +0000
commit8851e27d2cb947ea8bbbe8e812068f7bf5cbd00b (patch)
treecb541b12e6503ac69c2c0d20bd423e721a11507a
parentrust: use the new name Location::file_as_c_str() in Rust >= 1.91.0 (diff)
downloadkernel-8851e27d2cb947ea8bbbe8e812068f7bf5cbd00b.tar.gz
kernel-8851e27d2cb947ea8bbbe8e812068f7bf5cbd00b.zip
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 <[email protected]> Link: https://github.com/rust-lang/rust/pull/144443 [1] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
-rw-r--r--scripts/generate_rust_target.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 39c82908ff3a..38b3416bb979 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -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"]);
- ts.push("target-pointer-width", "64");
+ 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");
- ts.push("target-pointer-width", "32");
+ 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 {