Skip to content

Commit 225a5ef

Browse files
authored
Merge pull request #42071 from etcwilde/ewilde/link-dispatch-blocks-for-concurrency
Fix statically linked concurrency on Linux
2 parents b080190 + 1977a68 commit 225a5ef

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

stdlib/public/runtime/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,13 @@ foreach(sdk ${SWIFT_SDKS})
209209
if(${SWIFT_SDK_${sdk}_OBJECT_FORMAT} STREQUAL ELF)
210210
string(TOLOWER "${sdk}" lowercase_sdk)
211211
set(libpthread -lpthread)
212+
set(concurrency_libs)
212213
set(android_libraries)
213214
if(${sdk} STREQUAL ANDROID)
214215
set(android_libraries -llog)
215216
set(libpthread)
217+
elseif(SWIFT_CONCURRENCY_USES_DISPATCH)
218+
set(concurrency_libs "-ldispatch -lBlocksRuntime")
216219
endif()
217220

218221
set(linkfile ${lowercase_sdk}/static-stdlib-args.lnk)
@@ -221,6 +224,7 @@ foreach(sdk ${SWIFT_SDKS})
221224
${libpthread}
222225
${android_libraries}
223226
-lswiftCore
227+
${concurrency_libs}
224228
-lstdc++
225229
-lm
226230
-Xlinker -export-dynamic

utils/static-executable-args.lnk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
-undefined=pthread_once
77
-Xlinker
88
-undefined=pthread_key_create
9+
-ldispatch
10+
-lBlocksRuntime
911
-lpthread
1012
-licui18nswift
1113
-licuucswift

0 commit comments

Comments
 (0)