@@ -48,6 +48,7 @@ class SILLinker : public SILModuleTransform {
4848 // (swift_retain, etc.). Link them in so they can be referenced in IRGen.
4949 if (M.getOptions ().EmbeddedSwift && LinkEmbeddedRuntime) {
5050 linkEmbeddedRuntimeFromStdlib ();
51+ linkEmbeddedConcurrencyHookImpls ();
5152 }
5253
5354 // In embedded Swift, we need to explicitly link any @_used globals and
@@ -80,6 +81,26 @@ class SILLinker : public SILModuleTransform {
8081 linkEmbeddedRuntimeFunctionByName (" swift_retainCount" , { RefCounting });
8182 }
8283
84+ void linkEmbeddedConcurrencyHookImpls () {
85+ using namespace RuntimeConstants ;
86+
87+ // Note: we ignore errors here, because, depending on the exact situation
88+ //
89+ // (a) We might not have Concurrency anyway, and
90+ //
91+ // (b) The Impl function might be implemented in C++.
92+ //
93+ // Also, the hook Impl functions are marked as internal, unlike the
94+ // runtime functions, which are public.
95+
96+ #define SWIFT_CONCURRENCY_HOOK (RETURNS, NAME, ...) \
97+ linkUsedFunctionByName (#NAME " Impl" , SILLinkage::HiddenExternal)
98+ #define SWIFT_CONCURRENCY_HOOK0 (RETURNS, NAME ) \
99+ linkUsedFunctionByName (#NAME " Impl" , SILLinkage::HiddenExternal)
100+
101+ #include " swift/Runtime/ConcurrencyHooks.def"
102+ }
103+
83104 void linkEmbeddedRuntimeFunctionByName (StringRef name,
84105 ArrayRef<RuntimeEffect> effects) {
85106 SILModule &M = *getModule ();
0 commit comments