opt/rust/0002-compiler-Change-LLVM-targets.patch

60 lines
2.8 KiB
Diff
Raw Normal View History

2021-08-30 13:00:09 +02:00
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
2022-12-17 12:40:44 +01:00
index f2ee52262ade..6a813c4b8707 100644
2021-08-30 13:00:09 +02:00
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
2022-12-17 12:40:44 +01:00
@@ -1832,7 +1832,7 @@ pub fn parse_target_triple(
2022-05-21 12:20:18 +02:00
early_error(error_format, &format!("target file {path:?} does not exist"))
2021-08-30 13:00:09 +02:00
})
}
- Some(target) => TargetTriple::TargetTriple(target),
+ Some(target) => TargetTriple::from_alias(target),
_ => TargetTriple::from_triple(host_triple()),
}
}
diff --git a/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
2022-12-17 12:40:44 +01:00
index 73e536a7e4d9..af48d437533c 100644
2023-12-28 23:19:39 +01:00
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
2021-08-30 13:00:09 +02:00
@@ -9,7 +9,7 @@ pub fn target() -> Target {
2022-12-17 12:40:44 +01:00
base.stack_probes = StackProbeType::X86;
2021-08-30 13:00:09 +02:00
Target {
2022-05-21 12:20:18 +02:00
- llvm_target: "i686-unknown-linux-gnu".into(),
+ llvm_target: "i686-pc-linux-gnu".into(),
2021-08-30 13:00:09 +02:00
pointer_width: 32,
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
f64:32:64-f80:32-n8:16:32-S128"
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
2022-12-17 12:40:44 +01:00
index 8909cf33af91..e5b5bce4c290 100644
2021-08-30 13:00:09 +02:00
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
2022-12-17 12:40:44 +01:00
@@ -2876,6 +2876,15 @@ pub fn from_path(path: &Path) -> Result<Self, io::Error> {
Ok(TargetTriple::TargetJson { path_for_rustdoc: canonicalized_path, triple, contents })
2021-08-30 13:00:09 +02:00
}
+ /// Creates a target triple from its alias
+ pub fn from_alias(triple: String) -> Self {
+ match triple.as_str() {
+ "x86_64-pc-linux-gnu" => TargetTriple::from_triple("x86_64-unknown-linux-gnu"),
+ "i686-pc-linux-gnu" => TargetTriple::from_triple("i686-unknown-linux-gnu"),
+ _ => TargetTriple::TargetTriple(triple),
+ }
+ }
+
/// Returns a string triple for this target.
///
/// If this target is a path, the file name (without extension) is returned.
diff --git a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs
2022-12-17 12:40:44 +01:00
index a91ab365b668..d605eb9ccf81 100644
2023-12-28 23:19:39 +01:00
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
2022-12-17 12:40:44 +01:00
@@ -14,7 +14,7 @@ pub fn target() -> Target {
2022-05-21 12:20:18 +02:00
| SanitizerSet::THREAD;
2021-08-30 13:00:09 +02:00
Target {
2022-05-21 12:20:18 +02:00
- llvm_target: "x86_64-unknown-linux-gnu".into(),
+ llvm_target: "x86_64-pc-linux-gnu".into(),
2021-08-30 13:00:09 +02:00
pointer_width: 64,
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
2022-05-21 12:20:18 +02:00
.into(),