Skip to content

Commit b1c1354

Browse files
committed
rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing
All PowerPC64 targets except AIX explicitly set the ABI in the target options. We can therefore stop hardcoding the ABI to be used based on the target environment or OS, except for the AIX special case. The fallback based on endianness is kept for the sake of compatibility with custom targets. This makes it so that big endian targets not explicitly accounted for before (powerpc64-unknown-openbsd) and targets that don't use the expected default ABI (ELFv2 Glibc targets) use the correct ABI in the calling convention code. Signed-off-by: Jens Reidel <adrian@travitia.xyz>
1 parent 9f54abe commit b1c1354

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

compiler/rustc_target/src/callconv/powerpc64.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use rustc_abi::{Endian, HasDataLayout, TyAbiInterface};
66

77
use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform};
8-
use crate::spec::{Env, HasTargetSpec, Os};
8+
use crate::spec::{Abi, HasTargetSpec, Os};
99

1010
#[derive(Debug, Clone, Copy, PartialEq)]
1111
enum ABI {
@@ -106,8 +106,10 @@ where
106106
Ty: TyAbiInterface<'a, C> + Copy,
107107
C: HasDataLayout + HasTargetSpec,
108108
{
109-
let abi = if cx.target_spec().env == Env::Musl || cx.target_spec().os == Os::FreeBsd {
109+
let abi = if cx.target_spec().options.abi == Abi::ElfV2 {
110110
ELFv2
111+
} else if cx.target_spec().options.abi == Abi::ElfV1 {
112+
ELFv1
111113
} else if cx.target_spec().os == Os::Aix {
112114
AIX
113115
} else {

0 commit comments

Comments
 (0)