diff options
| author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2019-02-17 12:16:20 +0000 |
|---|---|---|
| committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2019-02-17 12:16:20 +0000 |
| commit | 66c60d9d714bed88765c1575fbf57e7582fd27a3 (patch) | |
| tree | 10985015d08c8b88087c54ca15b17d75ff7ce8b3 /compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt | |
| parent | 91ecb69acdf4cffb4f879e12716465169848633e (diff) | |
| download | bcm5719-llvm-66c60d9d714bed88765c1575fbf57e7582fd27a3.tar.gz bcm5719-llvm-66c60d9d714bed88765c1575fbf57e7582fd27a3.zip | |
[compiler-rt] Build custom libcxx with libcxxabi
This changes add_custom_libcxx to also build libcxxabi and merges
the two into a static and hermetic library.
There are multiple advantages:
1) The resulting libFuzzer doesn't expose C++ internals and looks
like a plain C library.
2) We don't have to manually link in libstdc++ to provide cxxabi.
3) The sanitizer tests cannot interfere with an installed version
of libc++.so in LD_LIBRARY_PATH.
Differential Revision: https://reviews.llvm.org/D58013
llvm-svn: 354212
Diffstat (limited to 'compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt')
| -rw-r--r-- | compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt b/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt new file mode 100644 index 00000000000..c644dc2fd5d --- /dev/null +++ b/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.4.3) + +# Build static libcxxabi. +set(LIBCXXABI_STANDALONE_BUILD 1) +set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") +set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE STRING "") +set(LIBCXXABI_LIBCXX_PATH ${COMPILER_RT_LIBCXX_PATH} CACHE PATH "") +set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "") +add_subdirectory(${COMPILER_RT_LIBCXXABI_PATH} ${CMAKE_CURRENT_BINARY_DIR}/cxxabi) + +# Build static libcxx without exceptions. +set(LIBCXX_STANDALONE_BUILD 1) +set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "") +set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") +set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") +set(LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") + +# Use above libcxxabi. +set(LIBCXX_CXX_ABI "libcxxabi" CACHE STRING "") +set(LIBCXX_CXX_ABI_INTREE 1) +set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "") +set(LIBCXX_CXX_ABI_INCLUDE_PATHS ${COMPILER_RT_LIBCXXABI_PATH}/include CACHE PATH "") + +add_subdirectory(${COMPILER_RT_LIBCXX_PATH} ${CMAKE_CURRENT_BINARY_DIR}/cxx) |

