Skip to content

Link the concurrency runtime against libatomic on Linux #38501

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 1 commit into from
Jul 20, 2021
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
10 changes: 10 additions & 0 deletions stdlib/public/Concurrency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ 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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjmccall @buttaface is it possible to make this change in different PR? I would like to merge this change to unblock nightly toolchain.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, no problem. I can always add it later if you need this patch right away.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(SWIFT_HOST_VARIANT_ARCH MATCHES "armv6|armv7|i686")
list(APPEND swift_concurrency_link_libraries
atomic)
endif()
endif()

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