summaryrefslogtreecommitdiff
path: root/user/rust/0017-Use-the-ELFv2-ABI-on-powerpc64-musl.patch
blob: dd11dd568d1e68734859a58a1ab8d5b5ea074f68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From e1214a04a9f8a30b67665ef353e3934e15e24a16 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Wed, 8 Aug 2018 22:06:18 -0500
Subject: [PATCH 17/29] Use the ELFv2 ABI on powerpc64 musl

---
 src/librustc_target/abi/call/powerpc64.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/librustc_target/abi/call/powerpc64.rs b/src/librustc_target/abi/call/powerpc64.rs
index 0c5ec77a39..4851b25fe7 100644
--- a/src/librustc_target/abi/call/powerpc64.rs
+++ b/src/librustc_target/abi/call/powerpc64.rs
@@ -14,6 +14,7 @@
 
 use abi::call::{FnType, ArgType, Reg, RegKind, Uniform};
 use abi::{Align, Endian, HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods};
+use spec::HasTargetSpec;
 
 #[derive(Debug, Clone, Copy, PartialEq)]
 enum ABI {
@@ -136,11 +137,14 @@ fn classify_arg_ty<'a, Ty, C>(cx: C, arg: &mut ArgType<'a, Ty>, abi: ABI)
 
 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
+          C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout + HasTargetSpec
 {
-    let abi = match cx.data_layout().endian {
-        Endian::Big => ELFv1,
-        Endian::Little => ELFv2,
+    let abi = match cx.target_spec().target_env {
+        "musl" => ELFv2,
+        _ => match cx.data_layout().endian {
+            Endian::Big => ELFv1,
+            Endian::Little => ELFv2
+        }
     };
 
     if !fty.ret.is_ignore() {
-- 
2.18.0