void-packages/srcpkgs/rust/patches/0017-Use-ELFv2-ABI-on-all-powerpc64-targets.patch
2019-12-29 16:22:23 +01:00

51 lines
2.4 KiB
Diff

From 7344f8a173bb0c90591d1eb1d18cd4eb1553051e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sat, 21 Dec 2019 17:06:55 +0100
Subject: [PATCH 17/18] 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 a9683104..98e44af3 100644
--- a/src/librustc_target/abi/call/powerpc64.rs
+++ b/src/librustc_target/abi/call/powerpc64.rs
@@ -124,7 +124,7 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'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.24.0