From 4841062bd3d3a4b2c2d49e73972feed0342b53e0 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Thu, 2 Mar 2017 19:34:35 +0000 Subject: [libc++abi] Add option to enable definitions for the new/delete overloads. Summary: Currently both libc++ and libc++abi provide definitions for operator new/delete. However I believe this is incorrect and that one or the other should offer them. This patch adds the CMake option `-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS` which defaults to `OFF` unless otherwise specified. This means that by default only libc++ provides the new/delete definitions. Reviewers: mclow.lists, mehdi_amini, dexonsmith, beanz, jroelofs, danalbert, smeenai, rmaprath, mgorny Reviewed By: mehdi_amini Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30517 git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@296801 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f73d759..6f54b91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,9 @@ option(LIBCXXABI_HAS_EXTERNAL_THREAD_API option(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY "Build libc++abi with an externalized threading library. This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON" OFF) +option(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS + "Build libc++abi with definitions for operator new/delete. Normally libc++ + provides these definitions" OFF) option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS}) option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS}) set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.") @@ -409,7 +412,10 @@ if (LIBCXXABI_HAS_EXTERNAL_THREAD_API) endif() endif() -if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXXABI_ENABLE_SHARED) +set(LIBCXXABI_HAS_UNDEFINED_SYMBOLS ((NOT LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) + OR (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXXABI_ENABLE_SHARED))) + +if (LIBCXXABI_HAS_UNDEFINED_SYMBOLS) # Need to allow unresolved symbols if this is to work with shared library builds if (APPLE) add_link_flags("-undefined dynamic_lookup") -- cgit v1.2.3