Skip to content
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

[libc++][test] Workaround for atomic tests linker errors on Linux systems without libatomic.so #73398

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// static constexpr bool is_always_lock_free = implementation-defined;
// bool is_lock_free() const volatile noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// floating-point-type operator=(floating-point-type) volatile noexcept;
// floating-point-type operator=(floating-point-type) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// bool compare_exchange_strong(T& expected, T desired,
// memory_order success, memory_order failure) volatile noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// bool compare_exchange_weak(T& expected, T desired,
// memory_order success, memory_order failure) volatile noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// constexpr atomic() noexcept;
// constexpr atomic(floating-point-type) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// Clang's support for atomic operations on long double is broken. See https://github.com/llvm/llvm-project/issues/72893
// XFAIL: tsan
// XFAIL: target={{x86_64-.*}} && tsan
// XFAIL: target={{x86_64-.*}} && msan
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// T exchange(T, memory_order = memory_order::seq_cst) volatile noexcept;
// T exchange(T, memory_order = memory_order::seq_cst) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// XFAIL: LIBCXX-AIX-FIXME
// UNSUPPORTED: LIBCXX-AIX-FIXME
// Clang's support for atomic operations on long double is broken. See https://github.com/llvm/llvm-project/issues/72893
// XFAIL: tsan
// XFAIL: target={{x86_64-.*}} && tsan
// Hangs with msan.
// UNSUPPORTED: msan
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// floating-point-type fetch_add(floating-point-type,
// memory_order = memory_order::seq_cst) volatile noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// XFAIL: LIBCXX-AIX-FIXME
// UNSUPPORTED: LIBCXX-AIX-FIXME
// Clang's support for atomic operations on long double is broken. See https://github.com/llvm/llvm-project/issues/72893
// XFAIL: tsan
// XFAIL: target={{x86_64-.*}} && tsan
// Hangs with msan.
// UNSUPPORTED: msan
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// floating-point-type fetch_sub(floating-point-type,
// memory_order = memory_order::seq_cst) volatile noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// Clang's support for atomic operations on long double is broken. See https://github.com/llvm/llvm-project/issues/72893
// XFAIL: tsan
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// XFAIL: target={{x86_64-.*}} && tsan
// UNSUPPORTED: !non-lockfree-atomics

// floating-point-type load(memory_order = memory_order::seq_cst) volatile noexcept;
// floating-point-type load(memory_order = memory_order::seq_cst) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// static constexpr bool is_always_lock_free = implementation-defined;
// bool is_lock_free() const volatile noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// UNSUPPORTED: no-threads
// XFAIL: availability-synchronization_library-missing
// UNSUPPORTED: c++03, c++11, c++14, c++17
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// void notify_all() volatile noexcept;
// void notify_all() noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// UNSUPPORTED: no-threads
// XFAIL: availability-synchronization_library-missing
// UNSUPPORTED: c++03, c++11, c++14, c++17
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// void notify_one() volatile noexcept;
// void notify_one() noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// operator floating-point-type() volatile noexcept;
// operator floating-point-type() noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// XFAIL: LIBCXX-AIX-FIXME
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: LIBCXX-AIX-FIXME
// UNSUPPORTED: !non-lockfree-atomics
// Hangs with msan.
// UNSUPPORTED: msan

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: target={{.+}}-windows-gnu
// XFAIL: LIBCXX-AIX-FIXME
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: LIBCXX-AIX-FIXME
// UNSUPPORTED: !non-lockfree-atomics
// Hangs with msan.
// UNSUPPORTED: msan

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// Clang's support for atomic operations on long double is broken. See https://github.com/llvm/llvm-project/issues/72893
// XFAIL: tsan
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// XFAIL: target={{x86_64-.*}} && tsan
// UNSUPPORTED: !non-lockfree-atomics

// void store(floating-point-type, memory_order = memory_order::seq_cst) volatile noexcept;
// void store(floating-point-type, memory_order = memory_order::seq_cst) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
// XFAIL: availability-synchronization_library-missing
// Clang's support for atomic operations on long double is broken. See https://github.com/llvm/llvm-project/issues/72893
// XFAIL: tsan
// XFAIL: target={{x86_64-.*}} && tsan
// XFAIL: target={{x86_64-.*}} && msan
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic
// XFAIL: !has-64-bit-atomics
// UNSUPPORTED: !non-lockfree-atomics

// void wait(T old, memory_order order = memory_order::seq_cst) const volatile noexcept;
// void wait(T old, memory_order order = memory_order::seq_cst) const noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ struct TestFn {
A a(T(1));
static_assert(noexcept(std::atomic_notify_all(&a)), "");

std::atomic<bool> is_ready[2] = {false, false};
auto f = [&](int index) {
std::atomic<bool> is_ready[2];
is_ready[0] = false;
is_ready[1] = false;
auto f = [&](int index) {
assert(std::atomic_load(&a) == T(1));
is_ready[index].store(true);

Expand All @@ -63,8 +65,10 @@ struct TestFn {
volatile A a(T(2));
static_assert(noexcept(std::atomic_notify_all(&a)), "");

std::atomic<bool> is_ready[2] = {false, false};
auto f = [&](int index) {
std::atomic<bool> is_ready[2];
is_ready[0] = false;
is_ready[1] = false;
auto f = [&](int index) {
assert(std::atomic_load(&a) == T(2));
is_ready[index].store(true);

Expand Down
9 changes: 3 additions & 6 deletions libcxx/utils/libcxx/test/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,11 @@ def _getAndroidDeviceApi(cfg):
when=lambda cfg: hasCompileFlag(cfg, "-Xclang -verify-ignore-unexpected"),
),
Feature(
name="has-latomic",
name="add-latomic-workaround", # https://github.com/llvm/llvm-project/issues/73361
when=lambda cfg: sourceBuilds(
cfg,
"""
int main(int, char**) { return 0; }
""",
["-latomic"],
cfg, "int main(int, char**) { return 0; }", ["-latomic"]
),
actions=[AddLinkFlag("-latomic")],
),
Feature(
name="non-lockfree-atomics",
Expand Down
Loading