[libcxx-commits] [PATCH] D81190: [libc++] Link against libatomic when it is found
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 4 12:42:57 PDT 2020
ldionne created this revision.
Herald added subscribers: libcxx-commits, mstorsjo, jfb, dexonsmith, jkorous, mgorny.
Herald added a project: libc++.
Herald added a reviewer: libc++.
ldionne added reviewers: jfb, __simt__.
ldionne marked an inline comment as done.
ldionne added a subscriber: phosek.
ldionne added inline comments.
Comment at: libcxx/cmake/config-ix.cmake:101
+ check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
@phosek Is this right for Fuchsia?
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).
rG LLVM Github Monorepo
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 10768 bytes
Desc: not available
More information about the libcxx-commits