Skip to content

Commit a73f5d4

Browse files
ojedaopsiff
authored andcommitted
rust: support Rust >= 1.91.0 target spec
commit 8851e27d2cb947ea8bbbe8e812068f7bf5cbd00b upstream. 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: rust-lang/rust#144443 [1] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 17cab7b45f4db7fcc59420407e49ed66494a556c)
1 parent 82dbc78 commit a73f5d4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/generate_rust_target.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ fn main() {
223223
ts.push("features", features);
224224
ts.push("llvm-target", "x86_64-linux-gnu");
225225
ts.push("supported-sanitizers", ["kcfi", "kernel-address"]);
226-
ts.push("target-pointer-width", "64");
226+
if cfg.rustc_version_atleast(1, 91, 0) {
227+
ts.push("target-pointer-width", 64);
228+
} else {
229+
ts.push("target-pointer-width", "64");
230+
}
227231
} else if cfg.has("X86_32") {
228232
// This only works on UML, as i386 otherwise needs regparm support in rustc
229233
if !cfg.has("UML") {
@@ -243,7 +247,11 @@ fn main() {
243247
}
244248
ts.push("features", features);
245249
ts.push("llvm-target", "i386-unknown-linux-gnu");
246-
ts.push("target-pointer-width", "32");
250+
if cfg.rustc_version_atleast(1, 91, 0) {
251+
ts.push("target-pointer-width", 32);
252+
} else {
253+
ts.push("target-pointer-width", "32");
254+
}
247255
} else if cfg.has("LOONGARCH") {
248256
panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
249257
} else {

0 commit comments

Comments
 (0)