Contents of /trunk/rust/patches/rust-1.75.0-0003-compiler-Change-LLVM-targets.patch
Parent Directory | Revision Log
Revision 3809 -
(show annotations)
(download)
Thu Jan 4 09:15:38 2024 UTC (4 months, 1 week ago) by niro
File size: 4043 byte(s)
Thu Jan 4 09:15:38 2024 UTC (4 months, 1 week ago) by niro
File size: 4043 byte(s)
-rediffed for rustc-1.75.0
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org> |
3 | Date: Fri, 12 Mar 2021 17:31:56 +0100 |
4 | Subject: [PATCH] compiler: Change LLVM targets |
5 | |
6 | - Change x86_64-unknown-linux-gnu to use x86_64-pc-linux-gnu |
7 | - Change i686-unknown-linux-gnu to use i686-pc-linux-gnu |
8 | |
9 | Reintroduce the aliasing that was removed in 1.52.0 and alias the -pc- |
10 | triples to the -unknown- triples. This avoids defining proper -pc- |
11 | targets, as things break when this is done: |
12 | |
13 | - The crate ecosystem expects the -unknown- targets. Making -pc- |
14 | rustc's host triple (and thus default target) would break various |
15 | crates. |
16 | - Firefox's build breaks when the host triple (from |
17 | `rustc --version --verbose`) is different from the target triple |
18 | (from `rustc --print target-list`) that best matches autoconf. |
19 | --- |
20 | compiler/rustc_session/src/config.rs | 2 +- |
21 | compiler/rustc_target/src/spec/mod.rs | 9 +++++++++ |
22 | .../src/spec/targets/i686_unknown_linux_gnu.rs | 2 +- |
23 | .../src/spec/targets/x86_64_unknown_linux_gnu.rs | 2 +- |
24 | 4 files changed, 12 insertions(+), 3 deletions(-) |
25 | |
26 | diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs |
27 | index f745bc390cad..2f5e6ee95852 100644 |
28 | --- a/compiler/rustc_session/src/config.rs |
29 | +++ b/compiler/rustc_session/src/config.rs |
30 | @@ -2240,7 +2240,7 @@ pub fn parse_target_triple( |
31 | handler.early_error(format!("target file {path:?} does not exist")) |
32 | }) |
33 | } |
34 | - Some(target) => TargetTriple::TargetTriple(target), |
35 | + Some(target) => TargetTriple::from_alias(target), |
36 | _ => TargetTriple::from_triple(host_triple()), |
37 | } |
38 | } |
39 | diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs |
40 | index f04799482c83..76e4930fbfdb 100644 |
41 | --- a/compiler/rustc_target/src/spec/mod.rs |
42 | +++ b/compiler/rustc_target/src/spec/mod.rs |
43 | @@ -3488,6 +3488,15 @@ pub fn from_path(path: &Path) -> Result<Self, io::Error> { |
44 | Ok(TargetTriple::TargetJson { path_for_rustdoc: canonicalized_path, triple, contents }) |
45 | } |
46 | |
47 | + /// Creates a target triple from its alias |
48 | + pub fn from_alias(triple: String) -> Self { |
49 | + match triple.as_str() { |
50 | + "x86_64-pc-linux-gnu" => TargetTriple::from_triple("x86_64-unknown-linux-gnu"), |
51 | + "i686-pc-linux-gnu" => TargetTriple::from_triple("i686-unknown-linux-gnu"), |
52 | + _ => TargetTriple::TargetTriple(triple), |
53 | + } |
54 | + } |
55 | + |
56 | /// Returns a string triple for this target. |
57 | /// |
58 | /// If this target is a path, the file name (without extension) is returned. |
59 | 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 |
60 | index 0ca058b2fd2a..c3b34ad2a851 100644 |
61 | --- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs |
62 | +++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs |
63 | @@ -9,7 +9,7 @@ pub fn target() -> Target { |
64 | base.stack_probes = StackProbeType::X86; |
65 | |
66 | Target { |
67 | - llvm_target: "i686-unknown-linux-gnu".into(), |
68 | + llvm_target: "i686-pc-linux-gnu".into(), |
69 | pointer_width: 32, |
70 | data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\ |
71 | f64:32:64-f80:32-n8:16:32-S128" |
72 | 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 |
73 | index 80e267c163fa..c10da4b633f2 100644 |
74 | --- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs |
75 | +++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs |
76 | @@ -17,7 +17,7 @@ pub fn target() -> Target { |
77 | base.supports_xray = true; |
78 | |
79 | Target { |
80 | - llvm_target: "x86_64-unknown-linux-gnu".into(), |
81 | + llvm_target: "x86_64-pc-linux-gnu".into(), |
82 | pointer_width: 64, |
83 | data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
84 | .into(), |