2021-05-07 00:05:08 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2023-07-16 14:54:25 +00:00
|
|
|
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
|
2021-05-07 00:05:08 +00:00
|
|
|
Date: Fri, 12 Mar 2021 17:31:56 +0100
|
|
|
|
Subject: [PATCH] compiler: Change LLVM targets
|
|
|
|
|
|
|
|
- Change x86_64-unknown-linux-gnu to use x86_64-pc-linux-gnu
|
|
|
|
- Change i686-unknown-linux-gnu to use i686-pc-linux-gnu
|
|
|
|
|
|
|
|
Reintroduce the aliasing that was removed in 1.52.0 and alias the -pc-
|
|
|
|
triples to the -unknown- triples. This avoids defining proper -pc-
|
|
|
|
targets, as things break when this is done:
|
|
|
|
|
|
|
|
- The crate ecosystem expects the -unknown- targets. Making -pc-
|
|
|
|
rustc's host triple (and thus default target) would break various
|
|
|
|
crates.
|
|
|
|
- Firefox's build breaks when the host triple (from
|
|
|
|
`rustc --version --verbose`) is different from the target triple
|
|
|
|
(from `rustc --print target-list`) that best matches autoconf.
|
|
|
|
---
|
|
|
|
compiler/rustc_session/src/config.rs | 2 +-
|
|
|
|
compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs | 2 +-
|
|
|
|
compiler/rustc_target/src/spec/mod.rs | 9 +++++++++
|
|
|
|
.../rustc_target/src/spec/x86_64_unknown_linux_gnu.rs | 2 +-
|
|
|
|
4 files changed, 12 insertions(+), 3 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
|
2023-08-29 12:52:41 +00:00
|
|
|
index f97cb3440d25..e96a8749823a 100644
|
2021-05-07 00:05:08 +00:00
|
|
|
--- a/compiler/rustc_session/src/config.rs
|
|
|
|
+++ b/compiler/rustc_session/src/config.rs
|
2023-08-29 12:52:41 +00:00
|
|
|
@@ -2169,7 +2169,7 @@ pub fn parse_target_triple(
|
|
|
|
handler.early_error(format!("target file {path:?} does not exist"))
|
2021-05-07 00:05:08 +00: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-16 19:42:50 +00:00
|
|
|
index 73e536a7e4d9..af48d437533c 100644
|
2021-05-07 00:05:08 +00:00
|
|
|
--- a/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
|
|
|
|
+++ b/compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs
|
|
|
|
@@ -9,7 +9,7 @@ pub fn target() -> Target {
|
2022-12-16 19:42:50 +00:00
|
|
|
base.stack_probes = StackProbeType::X86;
|
2021-05-07 00:05:08 +00:00
|
|
|
|
|
|
|
Target {
|
2022-05-19 18:54:59 +00:00
|
|
|
- llvm_target: "i686-unknown-linux-gnu".into(),
|
|
|
|
+ llvm_target: "i686-pc-linux-gnu".into(),
|
2021-05-07 00:05:08 +00: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
|
2023-08-29 12:52:41 +00:00
|
|
|
index 2365dfaf1af8..7e92928d214d 100644
|
2021-05-07 00:05:08 +00:00
|
|
|
--- a/compiler/rustc_target/src/spec/mod.rs
|
|
|
|
+++ b/compiler/rustc_target/src/spec/mod.rs
|
2023-08-29 12:52:41 +00:00
|
|
|
@@ -3205,6 +3205,15 @@ pub fn from_path(path: &Path) -> Result<Self, io::Error> {
|
2022-08-11 23:28:20 +00:00
|
|
|
Ok(TargetTriple::TargetJson { path_for_rustdoc: canonicalized_path, triple, contents })
|
2021-05-07 00:05:08 +00: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
|
2023-08-29 12:52:41 +00:00
|
|
|
index 2f970f87cc64..f8a5eec3ad6c 100644
|
2021-05-07 00:05:08 +00:00
|
|
|
--- a/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs
|
|
|
|
+++ b/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs
|
2023-08-29 12:52:41 +00:00
|
|
|
@@ -17,7 +17,7 @@ pub fn target() -> Target {
|
2023-04-24 12:47:24 +00:00
|
|
|
base.supports_xray = true;
|
2021-05-07 00:05:08 +00:00
|
|
|
|
|
|
|
Target {
|
2022-05-19 18:54:59 +00:00
|
|
|
- llvm_target: "x86_64-unknown-linux-gnu".into(),
|
|
|
|
+ llvm_target: "x86_64-pc-linux-gnu".into(),
|
2021-05-07 00:05:08 +00: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-19 18:54:59 +00:00
|
|
|
.into(),
|