void-packages/srcpkgs/rust/patches/0016-Use-ELFv2-ABI-on-all-powerpc64-targets.patch
2020-02-23 19:56:54 +01:00

51 lines
2.4 KiB
Diff

From 923d16b37c381d73ce0f88403256b26af3edf1bd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sat, 21 Dec 2019 17:06:55 +0100
Subject: [PATCH 16/16] Use ELFv2 ABI on all powerpc64 targets
This patches librustc_target so that ELFv2 is used everywhere, matching our
LLVM. While this is not perfect (it does not allow rustc to compile legacy
binaries), rustc never requests specific ABI from llvm in the first place,
so at least match the environment we have.
---
src/librustc_target/abi/call/powerpc64.rs | 2 +-
src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs | 6 +-----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/librustc_target/abi/call/powerpc64.rs b/src/librustc_target/abi/call/powerpc64.rs
index fe459480..997593b9 100644
--- a/src/librustc_target/abi/call/powerpc64.rs
+++ b/src/librustc_target/abi/call/powerpc64.rs
@@ -117,7 +117,7 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
where Ty: TyLayoutMethods<'a, C> + Copy,
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout + HasTargetSpec
{
- let abi = if cx.target_spec().target_env == "musl" {
+ let abi = if cx.target_spec().target_env == "musl" || cx.target_spec().target_env == "gnu" {
ELFv2
} else {
match cx.data_layout().endian {
diff --git a/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs b/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs
index 89e68ab3..77659cdd 100644
--- a/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs
+++ b/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs
@@ -1,4 +1,4 @@
-use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult, RelroLevel};
+use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
pub fn target() -> TargetResult {
let mut base = super::linux_base::opts();
@@ -6,10 +6,6 @@ pub fn target() -> TargetResult {
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
base.max_atomic_width = Some(64);
- // ld.so in at least RHEL6 on ppc64 has a bug related to BIND_NOW, so only enable partial RELRO
- // for now. https://github.com/rust-lang/rust/pull/43170#issuecomment-315411474
- base.relro_level = RelroLevel::Partial;
-
Ok(Target {
llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(),
--
2.25.0