[libcxx-commits] [libcxxabi] 9c30baf - [libcxxabi] Build all of libcxxabi with _LIBCPP_BUILDING_LIBRARY defined

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 2 23:33:24 PST 2020


Author: Martin Storsjö
Date: 2020-11-03T09:32:52+02:00
New Revision: 9c30bafd59bf1078bbe1c235c7c25bf7e278e2e9

URL: https://github.com/llvm/llvm-project/commit/9c30bafd59bf1078bbe1c235c7c25bf7e278e2e9
DIFF: https://github.com/llvm/llvm-project/commit/9c30bafd59bf1078bbe1c235c7c25bf7e278e2e9.diff

LOG: [libcxxabi] Build all of libcxxabi with _LIBCPP_BUILDING_LIBRARY defined

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

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index d9ed55aadc77..b8cdb188ebeb 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -282,6 +282,10 @@ endif()
 # 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)

diff  --git a/libcxxabi/src/fallback_malloc.cpp b/libcxxabi/src/fallback_malloc.cpp
index 8c0fd6c8db4b..75c01efebed2 100644
--- a/libcxxabi/src/fallback_malloc.cpp
+++ b/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>

diff  --git a/libcxxabi/src/stdlib_exception.cpp b/libcxxabi/src/stdlib_exception.cpp
index 88d911d96c96..b0cc431f2415 100644
--- a/libcxxabi/src/stdlib_exception.cpp
+++ b/libcxxabi/src/stdlib_exception.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_BUILDING_LIBRARY
 #include <new>
 #include <exception>
 

diff  --git a/libcxxabi/src/stdlib_new_delete.cpp b/libcxxabi/src/stdlib_new_delete.cpp
index 698c5f7c290c..58f181eb357f 100644
--- a/libcxxabi/src/stdlib_new_delete.cpp
+++ b/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>


        


More information about the libcxx-commits mailing list