Skip to content

Commit 7770d51

Browse files
committed
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. Thus conditionally use one or the other depending on the version. Link: rust-lang/rust#144443 [1] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 19272b3 commit 7770d51

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
@@ -225,7 +225,11 @@ fn main() {
225225
ts.push("features", features);
226226
ts.push("llvm-target", "x86_64-linux-gnu");
227227
ts.push("supported-sanitizers", ["kcfi", "kernel-address"]);
228-
ts.push("target-pointer-width", "64");
228+
if cfg.rustc_version_atleast(1, 91, 0) {
229+
ts.push("target-pointer-width", 64);
230+
} else {
231+
ts.push("target-pointer-width", "64");
232+
}
229233
} else if cfg.has("X86_32") {
230234
// This only works on UML, as i386 otherwise needs regparm support in rustc
231235
if !cfg.has("UML") {
@@ -245,7 +249,11 @@ fn main() {
245249
}
246250
ts.push("features", features);
247251
ts.push("llvm-target", "i386-unknown-linux-gnu");
248-
ts.push("target-pointer-width", "32");
252+
if cfg.rustc_version_atleast(1, 91, 0) {
253+
ts.push("target-pointer-width", 32);
254+
} else {
255+
ts.push("target-pointer-width", "32");
256+
}
249257
} else if cfg.has("LOONGARCH") {
250258
panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
251259
} else {

0 commit comments

Comments
 (0)