From 58422711d1fdb6af8d4c97e375197647926df622 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 25 Feb 2021 00:22:47 +0000 Subject: [PATCH] Remove sret attribute in llvm_abi.cpp --- src/llvm_abi.cpp | 17 +++++++++++++---- src/main.cpp | 4 ++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 327165da5..6c7c681a6 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -443,7 +443,10 @@ namespace lbAbi386 { case 4: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 32), nullptr, nullptr); case 8: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 64), nullptr, nullptr); } - return lb_arg_type_indirect(return_type, lb_create_enum_attribute(c, "sret", true)); + LLVMAttributeRef attr = nullptr; + // TODO(bill): sret doesn't work correct for LLVM C API + // attr = lb_create_enum_attribute(c, "sret", true); + return lb_arg_type_indirect(return_type, attr); } return non_struct(c, return_type, true); } @@ -601,7 +604,8 @@ namespace lbAbiAmd64SysV { if (attribute_kind == Amd64TypeAttribute_ByVal) { attribute = lb_create_enum_attribute(c, "byval", true); } else if (attribute_kind == Amd64TypeAttribute_StructRect) { - attribute = lb_create_enum_attribute(c, "sret", true); + // TODO(bill): sret doesn't work correct for LLVM C API + // attribute = lb_create_enum_attribute(c, "sret", true); } return lb_arg_type_indirect(type, attribute); } else { @@ -900,7 +904,10 @@ namespace lbAbiAmd64SysV { case 4: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 32), nullptr, nullptr); case 8: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 64), nullptr, nullptr); } - return lb_arg_type_indirect(return_type, lb_create_enum_attribute(c, "sret", true)); + LLVMAttributeRef attr = nullptr; + // TODO(bill): sret doesn't work correct for LLVM C API + // attr = lb_create_enum_attribute(c, "sret", true); + return lb_arg_type_indirect(return_type, attr); } else if (build_context.metrics.os == TargetOs_windows && lb_is_type_kind(return_type, LLVMIntegerTypeKind) && lb_sizeof(return_type) == 16) { return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 128), nullptr, nullptr); } @@ -1048,7 +1055,9 @@ namespace lbAbiArm64 { } return lb_arg_type_direct(type, cast_type, nullptr, nullptr); } else { - LLVMAttributeRef attr = lb_create_enum_attribute(c, "sret", true); + LLVMAttributeRef attr = nullptr; + // TODO(bill): sret doesn't work correct for LLVM C API + // attr = lb_create_enum_attribute(c, "sret", true); return lb_arg_type_indirect(type, attr); } } diff --git a/src/main.cpp b/src/main.cpp index a40a96ea9..4545f6f21 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -439,7 +439,11 @@ void linker_stage(lbGenerator *gen) { // This sets a requirement of Mountain Lion and up, but the compiler doesn't work without this limit. // NOTE: If you change this (although this minimum is as low as you can go with Odin working) // make sure to also change the 'mtriple' param passed to 'opt' + #if defined(GB_CPU_ARM) + " -macosx_version_min 11.0.0 " + #else " -macosx_version_min 10.8.0 " + #endif // This points the linker to where the entry point is " -e _main " #endif