Skip to content

Commit e212bd5

Browse files
[Concurrency] Hide async_Main from other object files
1 parent 356bfd5 commit e212bd5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/SIL/IR/SILDeclRef.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,13 @@ SILLinkage SILDeclRef::getDefinitionLinkage() const {
538538
// The main entry-point is public.
539539
if (kind == Kind::EntryPoint)
540540
return SILLinkage::Public;
541-
if (kind == Kind::AsyncEntryPoint)
542-
return SILLinkage::Hidden;
541+
if (kind == Kind::AsyncEntryPoint) {
542+
// async main entrypoint is referenced only from @main and
543+
// they are in the same SIL module. Hiding this entrypoint
544+
// from other object file makes it possible to link multiple
545+
// executable targets for SwiftPM testing with -entry-point-function-name
546+
return SILLinkage::Private;
547+
}
543548

544549
// Calling convention thunks have shared linkage.
545550
if (isForeignToNativeThunk())

0 commit comments

Comments
 (0)