File tree 1 file changed +12
-3
lines changed
compiler/rustc_target/src/abi/call
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use crate::spec::HasTargetSpec;
10
10
enum ABI {
11
11
ELFv1 , // original ABI used for powerpc64 (big-endian)
12
12
ELFv2 , // newer ABI used for powerpc64le and musl (both endians)
13
+ AIX , // used by AIX OS, big-endian only
13
14
}
14
15
use ABI :: * ;
15
16
23
24
C : HasDataLayout ,
24
25
{
25
26
arg. layout . homogeneous_aggregate ( cx) . ok ( ) . and_then ( |ha| ha. unit ( ) ) . and_then ( |unit| {
26
- // ELFv1 only passes one-member aggregates transparently.
27
+ // ELFv1 and AIX only passes one-member aggregates transparently.
27
28
// ELFv2 passes up to eight uniquely addressable members.
28
- if ( abi == ELFv1 && arg. layout . size > unit. size )
29
+ if ( ( abi == ELFv1 || abi == AIX ) && arg. layout . size > unit. size )
29
30
|| arg. layout . size > unit. size . checked_mul ( 8 , cx) . unwrap ( )
30
31
{
31
32
return None ;
55
56
return ;
56
57
}
57
58
59
+ // See https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/Targets/PPC.cpp.
60
+ if !is_ret && abi == AIX {
61
+ arg. make_indirect_byval ( None ) ;
62
+ return ;
63
+ }
64
+
58
65
// The ELFv1 ABI doesn't return aggregates in registers
59
- if is_ret && abi == ELFv1 {
66
+ if is_ret && ( abi == ELFv1 || abi == AIX ) {
60
67
arg. make_indirect ( ) ;
61
68
return ;
62
69
}
93
100
{
94
101
let abi = if cx. target_spec ( ) . env == "musl" {
95
102
ELFv2
103
+ } else if cx. target_spec ( ) . os == "aix" {
104
+ AIX
96
105
} else {
97
106
match cx. data_layout ( ) . endian {
98
107
Endian :: Big => ELFv1 ,
You can’t perform that action at this time.
0 commit comments