[libcxx-commits] [PATCH] D149092: [libcxxabi] disable lib{std}c++ assertions
Nick Desaulniers via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 24 13:03:29 PDT 2023
nickdesaulniers created this revision.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.
lib{std}c++ may be built with or without assertions. This causes
definitions of various methods of std::string_view to contain assertions
and calls to __libcpp_verbose_abort which libcxxabi does not provide.
Similar to flang (D143168 <https://reviews.llvm.org/D143168>, D143890 <https://reviews.llvm.org/D143890>), disable lib{std}c++ assertions when
building libcxxabi.
Otherwise D148566 <https://reviews.llvm.org/D148566> will trigger linkage failures for the missing symbol
__libcpp_verbose_abort.
Link: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
Link: https://libcxx.llvm.org/UsingLibcxx.html#enabling-the-safe-libc-mode
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149092
Files:
libcxxabi/src/CMakeLists.txt
Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -59,6 +59,11 @@
# Some files depend on libc++ internals.
include_directories("${LIBCXXABI_LIBCXX_PATH}/src")
+# Disable libstdc++/libc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build,
+# to avoid an unwanted dependency on libstdc++/libc++.so.
+add_definitions(-U_GLIBCXX_ASSERTIONS)
+add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS)
+
if (LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
add_definitions(-DHAVE___CXA_THREAD_ATEXIT_IMPL)
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149092.516511.patch
Type: text/x-patch
Size: 618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230424/36e31512/attachment.bin>
More information about the libcxx-commits
mailing list