0011-Use-ELFv2-ABI-on-all-powerpc64-targets.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From de93abe8a0d9dc7878a48f61b9e3ae4a923020f6 Mon Sep 17 00:00:00 2001
  2. From: q66 <daniel@octaforge.org>
  3. Date: Sun, 3 May 2020 18:08:09 +0200
  4. Subject: [PATCH 11/15] Use ELFv2 ABI on all powerpc64 targets
  5. This patches librustc_target so that ELFv2 is used everywhere, matching our
  6. LLVM. While this is not perfect (it does not allow rustc to compile legacy
  7. binaries), rustc never requests specific ABI from llvm in the first place,
  8. so at least match the environment we have.
  9. ---
  10. compiler/rustc_target/src/abi/call/powerpc64.rs | 9 +--------
  11. .../rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs | 6 +-----
  12. 2 files changed, 2 insertions(+), 13 deletions(-)
  13. diff --git a/compiler/rustc_target/src/abi/call/powerpc64.rs b/compiler/rustc_target/src/abi/call/powerpc64.rs
  14. index c22ef9c8f..932172b2f 100644
  15. --- a/compiler/rustc_target/src/abi/call/powerpc64.rs
  16. +++ b/compiler/rustc_target/src/abi/call/powerpc64.rs
  17. @@ -119,14 +119,7 @@ where
  18. Ty: TyAbiInterface<'a, C> + Copy,
  19. C: HasDataLayout + HasTargetSpec,
  20. {
  21. - let abi = if cx.target_spec().env == "musl" {
  22. - ELFv2
  23. - } else {
  24. - match cx.data_layout().endian {
  25. - Endian::Big => ELFv1,
  26. - Endian::Little => ELFv2,
  27. - }
  28. - };
  29. + let abi = ELFv2;
  30. if !fn_abi.ret.is_ignore() {
  31. classify_ret(cx, &mut fn_abi.ret, abi);
  32. diff --git a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs
  33. index 24d5d187e..aa594b02e 100644
  34. --- a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs
  35. +++ b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs
  36. @@ -1,5 +1,5 @@
  37. use crate::abi::Endian;
  38. -use crate::spec::{LinkerFlavor, RelroLevel, Target, TargetOptions};
  39. +use crate::spec::{LinkerFlavor, Target, TargetOptions};
  40. pub fn target() -> Target {
  41. let mut base = super::linux_gnu_base::opts();
  42. @@ -7,10 +7,6 @@ pub fn target() -> Target {
  43. base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m64".into());
  44. base.max_atomic_width = Some(64);
  45. - // ld.so in at least RHEL6 on ppc64 has a bug related to BIND_NOW, so only enable partial RELRO
  46. - // for now. https://github.com/rust-lang/rust/pull/43170#issuecomment-315411474
  47. - base.relro_level = RelroLevel::Partial;
  48. -
  49. Target {
  50. llvm_target: "powerpc64-unknown-linux-gnu".into(),
  51. pointer_width: 64,
  52. --
  53. 2.37.2