[libcxx-commits] [PATCH] D90476: [libcxxabi] Build all of libcxxabi with _LIBCPP_BUILDING_LIBRARY defined

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 30 10:16:06 PDT 2020


mstorsjo created this revision.
mstorsjo added reviewers: libc++abi, ldionne.
Herald added a subscriber: mgorny.
Herald added a project: libc++abi.
Herald added 1 blocking reviewer(s): libc++abi.
mstorsjo requested review of this revision.

Various definitions from libcxx need to be set in the same way as if building libcxx itself.

Split out from D90021 <https://reviews.llvm.org/D90021> as requested by @ldionne.

The comment/define in fallback_malloc.cpp seems to be a bit stale; it was added in 4b47cbccd453c089f0a1d1699dd80718943986d0, but lost its current effect in 42f9868cd80d2e09c75f4642e0a66c7ecd38cf18 and the comment was reworded in 51fbb2e70ae8a2a8df24845f7b6fdf4a1aebce4f without touching the define. - @EricWF

This change in itself shouldn't have any effect on that aspect in fallback_malloc.cpp (whether it works as intended or not) as we still define `_LIBCPP_BUILDING_LIBRARY`, just defined projectwide now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90476

Files:
  libcxxabi/CMakeLists.txt
  libcxxabi/src/fallback_malloc.cpp
  libcxxabi/src/stdlib_exception.cpp
  libcxxabi/src/stdlib_new_delete.cpp


Index: libcxxabi/src/stdlib_new_delete.cpp
===================================================================
--- libcxxabi/src/stdlib_new_delete.cpp
+++ libcxxabi/src/stdlib_new_delete.cpp
@@ -8,7 +8,6 @@
 // This file implements the new and delete operators.
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_BUILDING_LIBRARY
 #include "__cxxabi_config.h"
 #include <new>
 #include <cstdlib>
Index: libcxxabi/src/stdlib_exception.cpp
===================================================================
--- libcxxabi/src/stdlib_exception.cpp
+++ libcxxabi/src/stdlib_exception.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_BUILDING_LIBRARY
 #include <new>
 #include <exception>
 
Index: libcxxabi/src/fallback_malloc.cpp
===================================================================
--- libcxxabi/src/fallback_malloc.cpp
+++ libcxxabi/src/fallback_malloc.cpp
@@ -6,9 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Define _LIBCPP_BUILDING_LIBRARY to ensure _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
-// is only defined when libc aligned allocation is not available.
-#define _LIBCPP_BUILDING_LIBRARY
 #include "fallback_malloc.h"
 
 #include <__threading_support>
Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -282,6 +282,10 @@
 # library.
 add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
 
+# libcxxabi needs to, for various reasons, include the libcpp headers as if
+# it is being built as part of libcxx.
+add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
+
 # Disable DLL annotations on Windows for static builds.
 if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
   add_definitions(-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90476.301943.patch
Type: text/x-patch
Size: 1952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201030/63355496/attachment.bin>


More information about the libcxx-commits mailing list