PKGBUILDs/extra/rust/0003-compiler-Change-LLVM-targets.patch

66 lines
3.2 KiB
Diff
Raw Normal View History

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.
---
2024-05-04 21:13:33 +00:00
compiler/rustc_session/src/config.rs | 4 ++++
.../rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs | 2 +-
.../rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
2021-05-07 00:05:08 +00:00
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
2024-09-06 23:41:26 +00:00
index e748d1ff47b6..e653865a553f 100644
2021-05-07 00:05:08 +00:00
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
2024-09-06 23:41:26 +00:00
@@ -1997,6 +1997,10 @@ pub fn parse_target_triple(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches
2024-03-21 23:40:26 +00:00
early_dcx.early_fatal(format!("target file {path:?} does not exist"))
2021-05-07 00:05:08 +00:00
})
}
2024-05-04 21:13:33 +00:00
+ Some(s) if &s == "x86_64-pc-linux-gnu" => {
+ TargetTriple::from_triple("x86_64-unknown-linux-gnu")
+ }
+ Some(s) if &s == "i686-pc-linux-gnu" => TargetTriple::from_triple("i686-unknown-linux-gnu"),
Some(target) => TargetTriple::TargetTriple(target),
2021-05-07 00:05:08 +00:00
_ => TargetTriple::from_triple(host_triple()),
}
2024-01-03 02:00:18 +00:00
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
2024-09-06 23:41:26 +00:00
index 5584435a0ad9..06107a19948b 100644
2024-01-03 02:00:18 +00: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
@@ -9,7 +9,7 @@ pub fn target() -> Target {
2024-02-10 17:11:03 +00:00
base.stack_probes = StackProbeType::Inline;
2024-01-03 02:00:18 +00:00
Target {
- llvm_target: "i686-unknown-linux-gnu".into(),
+ llvm_target: "i686-pc-linux-gnu".into(),
2024-05-04 21:13:33 +00:00
metadata: crate::spec::TargetMetadata {
2024-09-06 23:41:26 +00:00
description: Some("32-bit Linux (kernel 3.2, glibc 2.17+)".into()),
tier: Some(1),
2024-01-03 02:00:18 +00:00
diff --git 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
2024-09-06 23:41:26 +00:00
index 4a92d4ef9d5c..1618f1656270 100644
2024-01-03 02:00:18 +00: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
2024-07-26 15:42:09 +00:00
@@ -26,7 +26,7 @@ pub fn target() -> Target {
}
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(),
2024-05-04 21:13:33 +00:00
metadata: crate::spec::TargetMetadata {
2024-09-06 23:41:26 +00:00
description: Some("64-bit Linux (kernel 3.2+, glibc 2.17+)".into()),
tier: Some(1),