[libc++] Link against libatomic when it is found

Authored by ldionne on Jun 4 2020, 11:54 AM.


[libc++] Link against libatomic when it is found

Before this patch, we tried detecting whether small atomics were available
without linking against libatomic. However, that's not really what we want
to know -- instead, we want to know what's required in order to support
atomics fully, which is to link against libatomic when it's provided.

That is both much simpler, and it doesn't suffer the problem that we would
not link against libatomic when small atomics didn't require it, which
lead to non-lockfree atomics never working.

Furthermore, because we understand that some platforms might not want to
(or be able to) ship non-lockfree atomics, we add that notion to the test
suite, independently of a potential extern library.

After this patch, we therefore:
(1) Link against libatomic when it is provided
(2) Independently detect whether non-lockfree atomics are supported in

the test suite, regardless of whether that means we're linking against
an external library or not (which is an implementation detail).

Differential Revision: https://reviews.llvm.org/D81190


ldionneJun 5 2020, 6:28 AM
Differential Revision
D81190: [libc++] Link against libatomic when it is found
rGa6fcf5ca033a: [clang][BFloat] add NEON emitter for bfloat