x86: rust: set rustc-abi=x86-softfloat on rustc>=1.86.0 · oracle/linux-uek@6273a05 (original) (raw)

Original file line number Diff line number Diff line change
@@ -165,6 +165,18 @@ impl KernelConfig {
165 165 let option = "CONFIG_".to_owned() + option;
166 166 self.0.contains_key(&option)
167 167 }
168 +
169 +/// Is the rustc version at least `major.minor.patch`?
170 + fn rustc_version_atleast(&self, major: u32, minor: u32, patch: u32) -> bool {
171 +let check_version = 100000 * major + 100 * minor + patch;
172 +let actual_version = self
173 +.0
174 +.get("CONFIG_RUSTC_VERSION")
175 +.unwrap()
176 +.parse::<u32>()
177 +.unwrap();
178 + check_version <= actual_version
179 +}
168 180 }
169 181
170 182 fn main() {
@@ -182,6 +194,9 @@ fn main() {
182 194 }
183 195 } else if cfg.has("X86_64") {
184 196 ts.push("arch", "x86_64");
197 +if cfg.rustc_version_atleast(1, 86, 0) {
198 + ts.push("rustc-abi", "x86-softfloat");
199 +}
185 200 ts.push(
186 201 "data-layout",
187 202 "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
@@ -215,6 +230,9 @@ fn main() {
215 230 panic!("32-bit x86 only works under UML");
216 231 }
217 232 ts.push("arch", "x86");
233 +if cfg.rustc_version_atleast(1, 86, 0) {
234 + ts.push("rustc-abi", "x86-softfloat");
235 +}
218 236 ts.push(
219 237 "data-layout",
220 238 "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",