diff options
author | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2017-01-03 12:58:34 +0000 |
---|---|---|
committer | Asiri Rathnayake <asiri.rathnayake@arm.com> | 2017-01-03 12:58:34 +0000 |
commit | 97ba9fae1f536778b1aaff4220512626e6170728 (patch) | |
tree | b571c9be99563d7dd7d8343a904a53f00d1addf9 /libcxxabi/CMakeLists.txt | |
parent | b44b4cbae8417b2f51ff7316b06326f5ed79929c (diff) | |
download | bcm5719-llvm-97ba9fae1f536778b1aaff4220512626e6170728.tar.gz bcm5719-llvm-97ba9fae1f536778b1aaff4220512626e6170728.zip |
[libcxxabi] Introduce an externally threaded libc++abi variant.
r281179 Introduced an externally threaded variant of the libc++ library. This
patch adds support for a similar library variant for libc++abi.
Differential revision: https://reviews.llvm.org/D27575
Reviewers: EricWF
llvm-svn: 290888
Diffstat (limited to 'libcxxabi/CMakeLists.txt')
-rw-r--r-- | libcxxabi/CMakeLists.txt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index dbb3602315f..f51f402d851 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -118,6 +118,9 @@ option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF) option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF) option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON) option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF) +option(LIBCXXABI_HAS_EXTERNAL_THREAD_API + "Build libc++abi with an externalized threading API. + This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON." OFF) option(LIBCXXABI_BUILD_32_BITS "Build 32 bit libc++abi." ${LLVM_BUILD_32_BITS}) set(LIBCXXABI_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.") set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.") @@ -347,20 +350,46 @@ if (NOT LIBCXXABI_ENABLE_SHARED) list(APPEND LIBCXXABI_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC) endif() +# Threading if (NOT LIBCXXABI_ENABLE_THREADS) if (LIBCXXABI_HAS_PTHREAD_API) message(FATAL_ERROR "LIBCXXABI_HAS_PTHREAD_API can only" " be set to ON when LIBCXXABI_ENABLE_THREADS" " is also set to ON.") endif() + if (LIBCXXABI_HAS_EXTERNAL_THREAD_API) + message(FATAL_ERROR "LIBCXXABI_HAS_EXTERNAL_THREAD_API can only" + " be set to ON when LIBCXXABI_ENABLE_THREADS" + " is also set to ON.") + endif() add_definitions(-D_LIBCXXABI_HAS_NO_THREADS) endif() +if (LIBCXXABI_HAS_PTHREAD_API AND LIBCXXABI_HAS_EXTERNAL_THREAD_API) + message(FATAL_ERROR "The options LIBCXXABI_HAS_EXTERNAL_THREAD_API" + "and LIBCXXABI_HAS_PTHREAD_API cannot be both" + "set to ON at the same time.") +endif() + +if (LIBCXXABI_HAS_EXTERNAL_THREAD_API AND LIBCXXABI_ENABLE_SHARED) + # Need to allow unresolved symbols if this is to work with shared library builds + if (APPLE) + add_link_flags("-undefined dynamic_lookup") + else() + # Relax this restriction from HandleLLVMOptions + string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") + endif() +endif() + if (LIBCXXABI_HAS_PTHREAD_API) add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD) add_definitions(-D_LIBCXXABI_USE_THREAD_API_PTHREAD) endif() +if (LIBCXXABI_HAS_EXTERNAL_THREAD_API) + add_definitions(-D_LIBCXXABI_HAS_THREAD_API_EXTERNAL) +endif() + if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() |