From 7dbdffefb768062f28599c256b5e013ee26ff04e Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Thu, 29 Sep 2022 07:53:06 +0000 Subject: [PATCH] [CMake] Use libcxx targets for in-tree sanitizer C++ ABI When in-tree libcxx is selected as the sanitizer C++ ABI, use libcxx targets rather than libcxxabi and libunwind, since those may not be available on all platforms (Windows for example). Differential Revision: https://reviews.llvm.org/D134855 --- compiler-rt/CMakeLists.txt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 8380b19..2d99d3a 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -579,17 +579,10 @@ if (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libc++") # because we added -nodefaultlibs there earlier, and adding would result in # a warning, but if we switch to -nostdlib++, we would need to add it here. # append_list_if(CXX_SUPPORTS_UNWINDLIB_NONE_FLAG --unwindlib=none SANITIZER_COMMON_LINK_FLAGS) - - if (SANITIZER_USE_STATIC_LLVM_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND)) - list(APPEND SANITIZER_CXX_ABI_LIBRARIES unwind_static) - elseif (TARGET unwind_shared OR HAVE_LIBUNWIND) - list(APPEND SANITIZER_CXX_ABI_LIBRARIES unwind_shared) - endif() - - if (SANITIZER_USE_STATIC_CXX_ABI AND (TARGET cxxabi_static OR HAVE_LIBCXXABI)) - list(APPEND SANITIZER_CXX_ABI_LIBRARIES cxxabi_static) - elseif (TARGET cxxabi_shared OR HAVE_LIBCXXABI) - list(APPEND SANITIZER_CXX_ABI_LIBRARIES cxxabi_shared) + if(SANITIZER_USE_STATIC_CXX_ABI) + set(SANITIZER_CXX_ABI_LIBRARIES "$") + else() + set(SANITIZER_CXX_ABI_LIBRARIES "$,cxx_shared,cxx_static>>") endif() else() append_list_if(COMPILER_RT_HAS_LIBCXX c++ SANITIZER_CXX_ABI_LIBRARIES) -- 2.7.4