Skip to content

Commit a274328

Browse files
gbaraldiKristofferC
authored andcommitted
Fix M1 tail call issue when building (#44279)
(cherry picked from commit 629eb86)
1 parent e23618d commit a274328

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ccall.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,11 @@ static GlobalVariable *emit_plt_thunk(
233233
else {
234234
// musttail support is very bad on ARM, PPC, PPC64 (as of LLVM 3.9)
235235
// Known failures includes vararg (not needed here) and sret.
236-
#if (defined(_CPU_X86_) || defined(_CPU_X86_64_) || \
237-
defined(_CPU_AARCH64_))
236+
237+
#if (defined(_CPU_X86_) || defined(_CPU_X86_64_) || (defined(_CPU_AARCH64_) && !defined(_OS_DARWIN_)))
238238
// Ref https://bugs.llvm.org/show_bug.cgi?id=47058
239239
// LLVM, as of 10.0.1 emits wrong/worse code when musttail is set
240+
// Apple silicon macs give an LLVM ERROR if musttail is set here #44107.
240241
if (!attrs.hasAttrSomewhere(Attribute::ByVal))
241242
ret->setTailCallKind(CallInst::TCK_MustTail);
242243
#endif

0 commit comments

Comments
 (0)