void-packages/srcpkgs/rust/patches/use-elfv2-everywhere.patch
2019-05-27 18:05:22 +02:00

35 lines
1.8 KiB
Diff

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.
--- rustc-1.35.0-src/src/librustc_target/abi/call/powerpc64.rs
+++ rustc-1.35.0-src/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 {
--- rustc-1.35.0-src/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs
+++ rustc-1.35.0-src/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(),