[libcxx-commits] [libcxx] [libc++] Floating Point Atomic (PR #67799)

Petr Hosek via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 22 15:34:03 PST 2023


petrhosek wrote:

> > > > We started seeing tests failures after this patch:
> > > > [...]
> > > 
> > > 
> > > This is likely because our tests didn't reference that function before (our tests for atomics were very very naive). But that function should be provided by compiler-rt. Can you dig into it a bit more? This isn't something wrong with this patch per se, it's probably something wrong with the testing configuration on Fuchsia (which might be attributable to libc++'s config or not).
> > 
> > 
> > To be clear, this is a Fuchsia Clang toolchain, but the test is actually failing on Linux so it's not Fuchsia-specific. What's somewhat unusual for our toolchain is that we ship `libclang_rt.atomic.so` (that's part of compiler-rt) and there is no `libatomic.so` (that's part of GCC) available on our bots (because we want our toolchain to be fully hermetic). We already encountered an issue in compiler-rt tests which were linking `libatomic.so` unconditionally and we had to address that in https://reviews.llvm.org/D151680.
> > I see neither `libatomic.so` nor `libclang_rt.atomic.so` in the failing link command. Do you know how are those references satisfied in other toolchains?
> 
> Hello, the test is conditionally adding -latomic if compiling a dummy programme with -latomic return 0. In Libc++ CI, on Linux -latomic would be valid so it would add -latomic in the test. On Mac, -latomic would make the dummy program fail to compile/link , so it would not add the flag. But the test link fine without the flag.
> 
> I guess in Fushia, the -latomic dummy program test returned false , so it did not add the flag. What is the right way to link under fushia ?

To emphasize again, we're seeing this issue on Linux and *not* on Fuchsia.

The existing `has-latomic` feature test is insufficient: https://github.com/llvm/llvm-project/blob/48f5855e4c48709d71d7aae4595232a3296c735e/libcxx/utils/libcxx/test/features.py#L113-L122

`libatomic.so` is part of GCC and this test will only succeed when you have GCC installed on your machine. We don't have GCC installed on our bots, we use Clang exclusively. We need a similar test for `libclang_rt.atomic.so` which is the compiler-rt counterpart.

https://github.com/llvm/llvm-project/pull/67799


More information about the libcxx-commits mailing list