Skip to content

[5.5] Link the concurrency runtime against libatomic on Linux and Android #38523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions stdlib/public/Concurrency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ if(SWIFT_CONCURRENCY_USES_DISPATCH)
endif()
endif()

# Linux requires us to link an atomic library to use atomics.
# Frustratingly, in many cases this isn't necessary because the
# sequence is inlined, but we have some code that's just subtle
# enough to turn into runtime calls.
if(SWIFT_HOST_VARIANT STREQUAL "linux" OR
SWIFT_HOST_VARIANT STREQUAL "android")
list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_LINK_FLAGS
-latomic)
endif()

add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
../CompatibilityOverride/CompatibilityOverride.cpp
Expand Down