From 99eff6acb33fc754b09d5418b69a25848da1b92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Fri, 5 Jun 2020 01:11:32 +0200 Subject: [PATCH] Fix C ABI for AArch64 I don't claim to understand why this is more correct, I just compared the LLVM IR from one failing spec to what Clang would generate for the equivalent code. It doesn't seemm to break any other specs --- spec/compiler/codegen/c_abi/c_abi_spec.cr | 2 +- spec/std/llvm/aarch64_spec.cr | 2 +- src/llvm/abi/aarch64.cr | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/compiler/codegen/c_abi/c_abi_spec.cr b/spec/compiler/codegen/c_abi/c_abi_spec.cr index 1a772b897ae..8250abffa6e 100644 --- a/spec/compiler/codegen/c_abi/c_abi_spec.cr +++ b/spec/compiler/codegen/c_abi/c_abi_spec.cr @@ -55,7 +55,7 @@ describe "Code gen: C ABI" do ), &.to_i.should eq(3)) end - it "passes struct bigger than128 bits (for real)" do + it "passes struct bigger than 128 bits (for real)" do test_c( %( struct s { diff --git a/spec/std/llvm/aarch64_spec.cr b/spec/std/llvm/aarch64_spec.cr index ee30468f0d2..caaa9d8e0ff 100644 --- a/spec/std/llvm/aarch64_spec.cr +++ b/spec/std/llvm/aarch64_spec.cr @@ -140,7 +140,7 @@ class LLVM::ABI info = abi.abi_info(arg_types, return_type, true, ctx) info.arg_types.size.should eq(1) - info.arg_types[0].should eq(ArgType.indirect(str, Attribute::ByVal)) + info.arg_types[0].should eq(ArgType.indirect(str, nil)) info.return_type.should eq(ArgType.indirect(str, Attribute::StructRet)) end end diff --git a/src/llvm/abi/aarch64.cr b/src/llvm/abi/aarch64.cr index 52cf84ae4b8..14a576d415e 100644 --- a/src/llvm/abi/aarch64.cr +++ b/src/llvm/abi/aarch64.cr @@ -136,7 +136,7 @@ class LLVM::ABI::AArch64 < LLVM::ABI end ArgType.direct(aty, cast) else - ArgType.indirect(aty, LLVM::Attribute::ByVal) + ArgType.indirect(aty, nil) end end end