From 9c30bafd59bf1078bbe1c235c7c25bf7e278e2e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Fri, 30 Oct 2020 19:11:23 +0200 Subject: [PATCH] [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 --- libcxxabi/CMakeLists.txt | 4 ++++ libcxxabi/src/fallback_malloc.cpp | 3 --- libcxxabi/src/stdlib_exception.cpp | 1 - libcxxabi/src/stdlib_new_delete.cpp | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index d9ed55a..b8cdb18 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 8c0fd6c..75c01ef 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 88d911d..b0cc431 100644 --- a/libcxxabi/src/stdlib_exception.cpp +++ b/libcxxabi/src/stdlib_exception.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#define _LIBCPP_BUILDING_LIBRARY #include #include diff --git a/libcxxabi/src/stdlib_new_delete.cpp b/libcxxabi/src/stdlib_new_delete.cpp index 698c5f7..58f181e 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 #include -- 2.7.4