Skip to content

Commit 19ea375

Browse files
committed
microsoft/surface: add patch to handle newer rust versions
1 parent d62603a commit 19ea375

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

microsoft/surface/common/kernel/6.12/patches.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,8 @@
151151
name = "ms-surface/0014-rtc";
152152
patch = patchSrc + "/0014-rtc.patch";
153153
}
154+
{
155+
name = "rust-1.91-fix";
156+
patch = ../rust_1-91_fix.patch;
157+
}
154158
]

microsoft/surface/common/kernel/6.15/patches.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,8 @@
156156
name = "ms-surface/0015-rtc";
157157
patch = patchSrc + "/0015-rtc.patch";
158158
}
159+
{
160+
name = "rust-1.91-fix";
161+
patch = ../rust_1-91_fix.patch;
162+
}
159163
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
2+
index 39c82908ff3a3f..38b3416bb9799e 100644
3+
--- a/scripts/generate_rust_target.rs
4+
+++ b/scripts/generate_rust_target.rs
5+
@@ -225,7 +225,11 @@ fn main() {
6+
ts.push("features", features);
7+
ts.push("llvm-target", "x86_64-linux-gnu");
8+
ts.push("supported-sanitizers", ["kcfi", "kernel-address"]);
9+
- ts.push("target-pointer-width", "64");
10+
+ if cfg.rustc_version_atleast(1, 91, 0) {
11+
+ ts.push("target-pointer-width", 64);
12+
+ } else {
13+
+ ts.push("target-pointer-width", "64");
14+
+ }
15+
} else if cfg.has("X86_32") {
16+
// This only works on UML, as i386 otherwise needs regparm support in rustc
17+
if !cfg.has("UML") {
18+
@@ -245,7 +249,11 @@ fn main() {
19+
}
20+
ts.push("features", features);
21+
ts.push("llvm-target", "i386-unknown-linux-gnu");
22+
- ts.push("target-pointer-width", "32");
23+
+ if cfg.rustc_version_atleast(1, 91, 0) {
24+
+ ts.push("target-pointer-width", 32);
25+
+ } else {
26+
+ ts.push("target-pointer-width", "32");
27+
+ }
28+
} else if cfg.has("LOONGARCH") {
29+
panic!("loongarch uses the builtin rustc loongarch64-unknown-none-softfloat target");
30+
} else {

0 commit comments

Comments
 (0)