[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
set(LIBCXX_HAS_SYSTEM_LIB NO)
+ check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
else()
----------------
@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).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D81190
Files:
libcxx/CMakeLists.txt
libcxx/cmake/Modules/CheckLibcxxAtomic.cmake
libcxx/cmake/config-ix.cmake
libcxx/test/libcxx/atomics/atomics.align/align.pass.pass.cpp
libcxx/test/libcxx/atomics/atomics.align/align.pass.sh.cpp
libcxx/test/libcxx/selftest/dsl/dsl.sh.py
libcxx/test/lit.site.cfg.in
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/dsl.py
libcxx/utils/libcxx/test/features.py
libcxx/utils/libcxx/test/target_info.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81190.268565.patch
Type: text/x-patch
Size: 10768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200604/881d9ca4/attachment.bin>
More information about the libcxx-commits
mailing list