2023-12-31 19:00:36 +00:00
|
|
|
From 184d61d2c12aa2db01de9a14ccb2be0cfae5039b Mon Sep 17 00:00:00 2001
|
2023-06-23 22:31:28 +00:00
|
|
|
From: Josh Stone <jistone@redhat.com>
|
|
|
|
Date: Fri, 9 Jun 2023 15:23:08 -0700
|
|
|
|
Subject: [PATCH] Let environment variables override some default CPUs
|
|
|
|
|
|
|
|
---
|
2023-12-31 19:00:36 +00:00
|
|
|
.../src/spec/targets/powerpc64le_unknown_linux_gnu.rs | 2 +-
|
|
|
|
.../rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs | 2 +-
|
|
|
|
.../rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs | 2 +-
|
2023-06-23 22:31:28 +00:00
|
|
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
|
2023-12-31 19:00:36 +00:00
|
|
|
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
|
|
|
|
index 194c3170e683..9806ca78297c 100644
|
|
|
|
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
|
|
|
|
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
|
2023-06-23 22:31:28 +00:00
|
|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
pub fn target() -> Target {
|
2023-12-31 19:00:36 +00:00
|
|
|
let mut base = base::linux_gnu::opts();
|
2023-06-23 22:31:28 +00:00
|
|
|
- base.cpu = "ppc64le".into();
|
|
|
|
+ base.cpu = option_env!("RUSTC_TARGET_CPU_PPC64LE").unwrap_or("ppc64le").into();
|
|
|
|
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
|
|
|
base.max_atomic_width = Some(64);
|
|
|
|
base.stack_probes = StackProbeType::Inline;
|
2023-12-31 19:00:36 +00:00
|
|
|
diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
|
|
|
|
index 6fc410eb2235..c8f84edb9715 100644
|
|
|
|
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
|
|
|
|
+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
|
2023-06-23 22:31:28 +00:00
|
|
|
@@ -5,7 +5,7 @@ pub fn target() -> Target {
|
2023-12-31 19:00:36 +00:00
|
|
|
let mut base = base::linux_gnu::opts();
|
2023-06-23 22:31:28 +00:00
|
|
|
base.endian = Endian::Big;
|
|
|
|
// z10 is the oldest CPU supported by LLVM
|
|
|
|
- base.cpu = "z10".into();
|
|
|
|
+ base.cpu = option_env!("RUSTC_TARGET_CPU_S390X").unwrap_or("z10").into();
|
|
|
|
// FIXME: The ABI implementation in cabi_s390x.rs is for now hard-coded to assume the no-vector
|
|
|
|
// ABI. Pass the -vector feature string to LLVM to respect this assumption. On LLVM < 16, we
|
|
|
|
// also strip v128 from the data_layout below to match the older LLVM's expectation.
|
2023-12-31 19:00:36 +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
|
|
|
|
index 80e267c163fa..8436a00e66d5 100644
|
|
|
|
--- 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
|
2023-06-23 22:31:28 +00:00
|
|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
|
|
pub fn target() -> Target {
|
2023-12-31 19:00:36 +00:00
|
|
|
let mut base = base::linux_gnu::opts();
|
2023-06-23 22:31:28 +00:00
|
|
|
- base.cpu = "x86-64".into();
|
|
|
|
+ base.cpu = option_env!("RUSTC_TARGET_CPU_X86_64").unwrap_or("x86-64").into();
|
2023-08-24 18:15:39 +00:00
|
|
|
base.plt_by_default = false;
|
2023-06-23 22:31:28 +00:00
|
|
|
base.max_atomic_width = Some(64);
|
|
|
|
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
|
|
|
|
--
|
2023-08-24 18:15:39 +00:00
|
|
|
2.41.0
|
2023-06-23 22:31:28 +00:00
|
|
|
|