Skip to content

Commit 4fabe6f

Browse files
authored
Use internal linkage for __NoopCoro_ResumeDestroy (#159407)
`__NoopCoro_ResumeDestroy` currently has private linkage, which causes [issues for Arm64EC](#158341). The Arm64EC lowering is trying to mangle and add thunks for `__NoopCoro_ResumeDestroy`, since it sees that it's address is taken (and, therefore, might be called from x64 code via a function pointer). MSVC's linker requires that the function be placed in COMDAT (`LNK1361: non COMDAT symbol '.L#__NoopCoro_ResumeDestroy' in hybrid binary`) which trips an assert in the verifier (`comdat global value has private linkage`) and the subsequent linking step fails since the private symbol isn't in the symbol table. Since there is no reason to use private linkage for `__NoopCoro_ResumeDestroy` and other coro related functions have also been [switched to internal linkage to improve debugging](#151224), this change switches to using internal linkage. Fixes #158341
1 parent 8b9c70d commit 4fabe6f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

llvm/lib/Transforms/Coroutines/CoroEarly.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void Lowerer::lowerCoroNoop(IntrinsicInst *II) {
132132

133133
// Create a Noop function that does nothing.
134134
Function *NoopFn = Function::createWithDefaultAttr(
135-
FnTy, GlobalValue::LinkageTypes::PrivateLinkage,
135+
FnTy, GlobalValue::LinkageTypes::InternalLinkage,
136136
M.getDataLayout().getProgramAddressSpace(), "__NoopCoro_ResumeDestroy",
137137
&M);
138138
NoopFn->setCallingConv(CallingConv::Fast);

llvm/test/Transforms/Coroutines/coro-noop-pacbti.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
; RUN: opt < %s -S -passes=coro-early | FileCheck %s
33

4-
; CHECK: define private fastcc void @__NoopCoro_ResumeDestroy(ptr %0) #1 {
4+
; CHECK: define internal fastcc void @__NoopCoro_ResumeDestroy(ptr %0) #1 {
55
; CHECK-NEXT: entry:
66
; CHECK-NEXT: ret void
77
; CHECK-NEXT: }

llvm/test/Transforms/Coroutines/coro-noop.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare ptr @llvm.coro.noop()
2626
!4 = !{i32 2, !"Debug Info Version", i32 3}
2727

2828

29-
; CHECK: define private fastcc void @__NoopCoro_ResumeDestroy(ptr %0) !dbg ![[RESUME:[0-9]+]] {
29+
; CHECK: define internal fastcc void @__NoopCoro_ResumeDestroy(ptr %0) !dbg ![[RESUME:[0-9]+]] {
3030
; CHECK-NEXT: entry
3131
; CHECK-NEXT: ret void
3232

0 commit comments

Comments
 (0)