aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-05-29 22:50:28 +0100
committergingerBill <bill@gingerbill.org>2023-05-29 22:50:28 +0100
commitf3a463000d4d777cf255bfebda3f51fba4ce8fcc (patch)
tree22cbccdac18ee0e6bfcc3b4dabaf56d35bf2302c
parentc38842ecb25dfbe1ebc6992684692874db3978ae (diff)
Fix #2561 - ARM64 ABI bug for homogenous structs with more than 4 elements
-rw-r--r--src/llvm_abi.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp
index dabdd6829..82eeac5fb 100644
--- a/src/llvm_abi.cpp
+++ b/src/llvm_abi.cpp
@@ -1179,7 +1179,11 @@ namespace lbAbiArm64 {
if (is_register(type)) {
args[i] = non_struct(c, type);
} else if (is_homogenous_aggregate(c, type, &homo_base_type, &homo_member_count)) {
- args[i] = lb_arg_type_direct(type, LLVMArrayType(homo_base_type, homo_member_count), nullptr, nullptr);
+ if (is_homogenous_aggregate_small_enough(homo_base_type, homo_member_count)) {
+ args[i] = lb_arg_type_direct(type, LLVMArrayType(homo_base_type, homo_member_count), nullptr, nullptr);
+ } else {
+ args[i] = lb_arg_type_indirect(type, nullptr);;
+ }
} else {
i64 size = lb_sizeof(type);
if (size <= 16) {