Skip to content

Commit

Permalink
Fix M1 tail call issue when building (#44279)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaraldi authored Feb 23, 2022
1 parent 333a3a3 commit 629eb86
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,11 @@ static GlobalVariable *emit_plt_thunk(
else {
// musttail support is very bad on ARM, PPC, PPC64 (as of LLVM 3.9)
// Known failures includes vararg (not needed here) and sret.
#if (defined(_CPU_X86_) || defined(_CPU_X86_64_) || \
defined(_CPU_AARCH64_))

#if (defined(_CPU_X86_) || defined(_CPU_X86_64_) || (defined(_CPU_AARCH64_) && !defined(_OS_DARWIN_)))
// Ref https://bugs.llvm.org/show_bug.cgi?id=47058
// LLVM, as of 10.0.1 emits wrong/worse code when musttail is set
// Apple silicon macs give an LLVM ERROR if musttail is set here #44107.
if (!attrs.hasAttrSomewhere(Attribute::ByVal))
ret->setTailCallKind(CallInst::TCK_MustTail);
#endif
Expand Down

0 comments on commit 629eb86

Please sign in to comment.