-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Link the concurrency runtime against libatomic on Linux #38501
Conversation
We mostly get away without this because we're fairly disciplined about using constant memory orderings, and apparently that's usually good enough to get inline accesses and avoid needing to link atomic. However, we have a few places with the task status atomic that use a non-constant load ordering with load and compare_exchange_weak, and my recent change to make that atomic a double-word was apparently sufficient on some (but not all) Linux distributions to get the compiler to call the runtime function. Regardless, we shouldn't be playing around in the margins here: Linux requires us to link libatomic, so we should.
@swift-ci Please test |
# 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind adding Android here? It is the only platform currently distributing an up-to-date Swift 5.4 toolchain for a 32-bit platform, armv7.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, thanks for the explanation in the opening comment, good to know! |
We will need this change on release/5.5 branch too, it's also failing there. |
We mostly get away without this because we're fairly disciplined about using constant memory orderings, and apparently that's usually good enough to get inline accesses and avoid needing to link atomic. However, we have a few places with the task status atomic that use a non-constant load ordering with
load
andcompare_exchange_weak
, and my recent change to make that atomic a double-word was apparently sufficient on some (but not all) Linux distributions to get the compiler to call the runtime function. Regardless, we shouldn't be playing around in the margins here: Linux requires us to link libatomic, so we should.