Skip to content

Commit 2bb5029

Browse files
committed
Use the ELFv2 ABI on powerpc64 musl
1 parent 346e976 commit 2bb5029

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/librustc_target/abi/call/powerpc64.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414

1515
use abi::call::{FnType, ArgType, Reg, RegKind, Uniform};
1616
use abi::{Align, Endian, HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods};
17+
use spec::HasTargetSpec;
1718

1819
#[derive(Debug, Clone, Copy, PartialEq)]
1920
enum ABI {
2021
ELFv1, // original ABI used for powerpc64 (big-endian)
21-
ELFv2, // newer ABI used for powerpc64le
22+
ELFv2, // newer ABI used for powerpc64le and musl (both endians)
2223
}
2324
use self::ABI::*;
2425

@@ -131,11 +132,15 @@ fn classify_arg_ty<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>, abi: ABI)
131132

132133
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>)
133134
where Ty: TyLayoutMethods<'a, C> + Copy,
134-
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout
135+
C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout + HasTargetSpec
135136
{
136-
let abi = match cx.data_layout().endian {
137-
Endian::Big => ELFv1,
138-
Endian::Little => ELFv2,
137+
let abi = if cx.target_spec().target_env == "musl" {
138+
ELFv2
139+
} else {
140+
match cx.data_layout().endian {
141+
Endian::Big => ELFv1,
142+
Endian::Little => ELFv2
143+
}
139144
};
140145

141146
if !fty.ret.is_ignore() {

0 commit comments

Comments
 (0)