diff options
author | Francis Ricci <francisjricci@gmail.com> | 2016-08-22 20:27:21 +0000 |
---|---|---|
committer | Francis Ricci <francisjricci@gmail.com> | 2016-08-22 20:27:21 +0000 |
commit | 7b27982757a733a21660c05b939285df52f00067 (patch) | |
tree | cea58dd2f314ca33101265c634037b7709e0c7ab /lib/ubsan/CMakeLists.txt | |
parent | 37a8f4803fc176a001f0f2d70250a7e99b5dfea5 (diff) |
[compiler-rt] Don't build ubsan cxxabi sources when unused
Summary:
On apple targets, when SANITIZER_CAN_USE_CXXABI is false,
the ubsan cxxabi sources aren't built, since they're unused.
Do this on non-apple targets as well.
This fixes errors when linking sanitizers if c++ abi is
unavailable.
Reviewers: pcc, kubabrecka, beanz
Subscribers: rnk, llvm-commits, kubabrecka, compnerd, dberris
Differential Revision: https://reviews.llvm.org/D23638
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/CMakeLists.txt')
-rw-r--r-- | lib/ubsan/CMakeLists.txt | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt index f2a3d60d6..fdac7694c 100644 --- a/lib/ubsan/CMakeLists.txt +++ b/lib/ubsan/CMakeLists.txt @@ -12,7 +12,7 @@ set(UBSAN_STANDALONE_SOURCES ubsan_init_standalone.cc ) -set(UBSAN_CXX_SOURCES +set(UBSAN_CXXABI_SOURCES ubsan_handlers_cxx.cc ubsan_type_hash.cc ubsan_type_hash_itanium.cc @@ -39,7 +39,7 @@ set_target_properties(ubsan PROPERTIES FOLDER "Compiler-RT Misc") if(APPLE) set(UBSAN_COMMON_SOURCES ${UBSAN_SOURCES}) if(SANITIZER_CAN_USE_CXXABI) - list(APPEND UBSAN_COMMON_SOURCES ${UBSAN_CXX_SOURCES}) + list(APPEND UBSAN_COMMON_SOURCES ${UBSAN_CXXABI_SOURCES}) endif() # Common parts of UBSan runtime. @@ -73,7 +73,16 @@ else() add_compiler_rt_object_libraries(RTUbsan ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH} SOURCES ${UBSAN_SOURCES} CFLAGS ${UBSAN_CFLAGS}) - # C++-specific parts of UBSan runtime. Requires a C++ ABI library. + + if(SANITIZER_CAN_USE_CXXABI) + # C++-specific parts of UBSan runtime. Requires a C++ ABI library. + set(UBSAN_CXX_SOURCES ${UBSAN_CXXABI_SOURCES}) + else() + # Dummy target if we don't have C++ ABI library. + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cxx_dummy.cc "") + set(UBSAN_CXX_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cxx_dummy.cc) + endif() + add_compiler_rt_object_libraries(RTUbsan_cxx ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH} SOURCES ${UBSAN_CXX_SOURCES} CFLAGS ${UBSAN_CXXFLAGS}) |