Skip to content

[DWARFLinkerParallel] Fix incorrect uses of compare_exchange_weak #138129

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
May 5, 2025

Conversation

mstorsjo
Copy link
Member

@mstorsjo mstorsjo commented May 1, 2025

The documentation for compare_exchange_weak says that it is allowed to spuriously fail. If compare_exchange_weak is called in a loop, spurious failures usually are benign - but in these cases, a spurious failure would give incorrect behaviour.

E.g. in TypePool::getOrCreateTypeEntryBody, we assume that if the compare_exchange call returned false, we had been preempted by another thread and that DIE is non-null.

This fixes running the dsymutil tests on Windows on aarch64 (built with a mingw toolchain with libc++).

The documentation for compare_exchange_weak says that it is
allowed to spuriously fail. If compare_exchange_weak is called
in a loop, spurious failures usually are benign - but in these
cases, a spurious failure would give incorrect behaviour.

E.g. in TypePool::getOrCreateTypeEntryBody, we assume that if the
compare_exchange call returned false, we had been preempted by
another thread and that DIE is non-null.

This fixes running the dsymutil tests on Windows on aarch64
(built with a mingw toolchain with libc++).
@mstorsjo mstorsjo requested a review from JDevlieghere as a code owner May 1, 2025 13:08
Copy link
Collaborator

@avl-llvm avl-llvm left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for catching this!

@mstorsjo mstorsjo merged commit 07bc54b into llvm:main May 5, 2025
12 checks passed
@mstorsjo mstorsjo deleted the dwarflinker-atomic branch May 5, 2025 12:06
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…vm#138129)

The documentation for compare_exchange_weak says that it is allowed to
spuriously fail. If compare_exchange_weak is called in a loop, spurious
failures usually are benign - but in these cases, a spurious failure
would give incorrect behaviour.

E.g. in TypePool::getOrCreateTypeEntryBody, we assume that if the
compare_exchange call returned false, we had been preempted by another
thread and that DIE is non-null.

This fixes running the dsymutil tests on Windows on aarch64 (built with
a mingw toolchain with libc++).
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…vm#138129)

The documentation for compare_exchange_weak says that it is allowed to
spuriously fail. If compare_exchange_weak is called in a loop, spurious
failures usually are benign - but in these cases, a spurious failure
would give incorrect behaviour.

E.g. in TypePool::getOrCreateTypeEntryBody, we assume that if the
compare_exchange call returned false, we had been preempted by another
thread and that DIE is non-null.

This fixes running the dsymutil tests on Windows on aarch64 (built with
a mingw toolchain with libc++).
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…vm#138129)

The documentation for compare_exchange_weak says that it is allowed to
spuriously fail. If compare_exchange_weak is called in a loop, spurious
failures usually are benign - but in these cases, a spurious failure
would give incorrect behaviour.

E.g. in TypePool::getOrCreateTypeEntryBody, we assume that if the
compare_exchange call returned false, we had been preempted by another
thread and that DIE is non-null.

This fixes running the dsymutil tests on Windows on aarch64 (built with
a mingw toolchain with libc++).
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
…vm#138129)

The documentation for compare_exchange_weak says that it is allowed to
spuriously fail. If compare_exchange_weak is called in a loop, spurious
failures usually are benign - but in these cases, a spurious failure
would give incorrect behaviour.

E.g. in TypePool::getOrCreateTypeEntryBody, we assume that if the
compare_exchange call returned false, we had been preempted by another
thread and that DIE is non-null.

This fixes running the dsymutil tests on Windows on aarch64 (built with
a mingw toolchain with libc++).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants