[compiler-rt] 20a269c - Revert "[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI"

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 05:59:52 PDT 2022


Author: Hans Wennborg
Date: 2022-10-03T14:56:07+02:00
New Revision: 20a269cf774e774fb5c7194b1aebe24df27a233f

URL: https://github.com/llvm/llvm-project/commit/20a269cf774e774fb5c7194b1aebe24df27a233f
DIFF: https://github.com/llvm/llvm-project/commit/20a269cf774e774fb5c7194b1aebe24df27a233f.diff

LOG: Revert "[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI"

It casued some runtimes builds to fail with cmake error

  No target "libcxx-abi-static"

see code review.

> When in-tree libcxx is selected as the sanitizer C++ ABI, use
> libcxx-abi-* targets rather than libcxxabi and libunwind directly.
>
> Differential Revision: https://reviews.llvm.org/D134855

This reverts commit 414f9b7d2f45670019dc8ec284b685a9e238718f.

Added: 
    

Modified: 
    compiler-rt/CMakeLists.txt
    compiler-rt/lib/asan/CMakeLists.txt
    compiler-rt/lib/hwasan/CMakeLists.txt
    compiler-rt/lib/memprof/CMakeLists.txt
    compiler-rt/lib/scudo/CMakeLists.txt
    compiler-rt/lib/tsan/dd/CMakeLists.txt
    compiler-rt/lib/tsan/rtl-old/CMakeLists.txt
    compiler-rt/lib/tsan/rtl/CMakeLists.txt
    compiler-rt/lib/ubsan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 814012192fc5..689ce1a8ee6e 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -579,10 +579,17 @@ 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_CXX_ABI)
-      set(SANITIZER_CXX_ABI_LIBRARIES "$<TARGET_LINKER_FILE:libcxx-abi-static>")
-    else()
-      set(SANITIZER_CXX_ABI_LIBRARIES "$<TARGET_LINKER_FILE:$<IF:$<TARGET_EXISTS:libcxx-abi-shared>,libcxx-abi-shared,libcxx-abi-static>>")
+
+    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)
     endif()
   else()
     append_list_if(COMPILER_RT_HAS_LIBCXX c++ SANITIZER_CXX_ABI_LIBRARIES)

diff  --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt
index 08fd68ab7acb..0e7250a8fa10 100644
--- a/compiler-rt/lib/asan/CMakeLists.txt
+++ b/compiler-rt/lib/asan/CMakeLists.txt
@@ -117,10 +117,7 @@ append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
   -ftls-model=initial-exec ASAN_DYNAMIC_CFLAGS)
 append_list_if(MSVC /DEBUG ASAN_DYNAMIC_LINK_FLAGS)
 
-set(ASAN_DYNAMIC_LIBS
-  ${COMPILER_RT_UNWINDER_LINK_LIBS}
-  ${SANITIZER_CXX_ABI_LIBRARIES}
-  ${SANITIZER_COMMON_LINK_LIBS})
+set(ASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBDL dl ASAN_DYNAMIC_LIBS)
 append_list_if(COMPILER_RT_HAS_LIBRT rt ASAN_DYNAMIC_LIBS)

diff  --git a/compiler-rt/lib/hwasan/CMakeLists.txt b/compiler-rt/lib/hwasan/CMakeLists.txt
index bffe41d8c0d2..6753a122a987 100644
--- a/compiler-rt/lib/hwasan/CMakeLists.txt
+++ b/compiler-rt/lib/hwasan/CMakeLists.txt
@@ -81,10 +81,7 @@ append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
   -ftls-model=initial-exec HWASAN_DYNAMIC_CFLAGS)
 append_list_if(MSVC /DEBUG HWASAN_DYNAMIC_LINK_FLAGS)
 
-set(HWASAN_DYNAMIC_LIBS
-  ${COMPILER_RT_UNWINDER_LINK_LIBS}
-  ${SANITIZER_CXX_ABI_LIBRARIES}
-  ${SANITIZER_COMMON_LINK_LIBS})
+set(HWASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBDL dl HWASAN_DYNAMIC_LIBS)
 append_list_if(COMPILER_RT_HAS_LIBRT rt HWASAN_DYNAMIC_LIBS)

diff  --git a/compiler-rt/lib/memprof/CMakeLists.txt b/compiler-rt/lib/memprof/CMakeLists.txt
index 2459ce13ab74..20d699206bc6 100644
--- a/compiler-rt/lib/memprof/CMakeLists.txt
+++ b/compiler-rt/lib/memprof/CMakeLists.txt
@@ -65,10 +65,7 @@ set(MEMPROF_DYNAMIC_CFLAGS ${MEMPROF_CFLAGS})
 append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
   -ftls-model=initial-exec MEMPROF_DYNAMIC_CFLAGS)
 
-set(MEMPROF_DYNAMIC_LIBS
-  ${COMPILER_RT_UNWINDER_LINK_LIBS}
-  ${SANITIZER_CXX_ABI_LIBRARIES}
-  ${SANITIZER_COMMON_LINK_LIBS})
+set(MEMPROF_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBDL dl MEMPROF_DYNAMIC_LIBS)
 append_list_if(COMPILER_RT_HAS_LIBRT rt MEMPROF_DYNAMIC_LIBS)

diff  --git a/compiler-rt/lib/scudo/CMakeLists.txt b/compiler-rt/lib/scudo/CMakeLists.txt
index c75ba2540afc..31a6976960f7 100644
--- a/compiler-rt/lib/scudo/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/CMakeLists.txt
@@ -50,9 +50,7 @@ if (FUCHSIA)
   list(APPEND SCUDO_CFLAGS -nostdinc++)
   list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -nostdlib++)
 else()
-  list(APPEND SCUDO_DYNAMIC_LIBS
-    ${COMPILER_RT_UNWINDER_LINK_LIBS}
-    ${SANITIZER_CXX_ABI_LIBRARIES})
+  list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES})
   list(APPEND SCUDO_OBJECT_LIBS
     RTSanitizerCommonCoverage
     RTSanitizerCommonSymbolizer

diff  --git a/compiler-rt/lib/tsan/dd/CMakeLists.txt b/compiler-rt/lib/tsan/dd/CMakeLists.txt
index a7359c573f14..ec107312d5a4 100644
--- a/compiler-rt/lib/tsan/dd/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/dd/CMakeLists.txt
@@ -10,10 +10,7 @@ set(DD_SOURCES
   dd_interceptors.cpp
   )
 
-set(DD_LINKLIBS
-  ${COMPILER_RT_UNWINDER_LINK_LIBS}
-  ${SANITIZER_CXX_ABI_LIBRARIES}
-  ${SANITIZER_COMMON_LINK_LIBS})
+set(DD_LINKLIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS)
 append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS)

diff  --git a/compiler-rt/lib/tsan/rtl-old/CMakeLists.txt b/compiler-rt/lib/tsan/rtl-old/CMakeLists.txt
index 7508bc5f7431..1f781c444ca1 100644
--- a/compiler-rt/lib/tsan/rtl-old/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/rtl-old/CMakeLists.txt
@@ -10,10 +10,7 @@ append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
 set(TSAN_RTL_DYNAMIC_CFLAGS ${TSAN_RTL_CFLAGS})
 list(REMOVE_ITEM TSAN_RTL_DYNAMIC_CFLAGS -fPIE)
 
-set(TSAN_DYNAMIC_LINK_LIBS
-  ${COMPILER_RT_UNWINDER_LINK_LIBS}
-  ${SANITIZER_CXX_ABI_LIBRARIES}
-  ${SANITIZER_COMMON_LINK_LIBS})
+set(TSAN_DYNAMIC_LINK_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBDL dl TSAN_DYNAMIC_LINK_LIBS)
 append_list_if(COMPILER_RT_HAS_LIBM m TSAN_DYNAMIC_LINK_LIBS)

diff  --git a/compiler-rt/lib/tsan/rtl/CMakeLists.txt b/compiler-rt/lib/tsan/rtl/CMakeLists.txt
index 0a12cb7021f6..e71268eea1fb 100644
--- a/compiler-rt/lib/tsan/rtl/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/rtl/CMakeLists.txt
@@ -10,10 +10,7 @@ append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
 set(TSAN_RTL_DYNAMIC_CFLAGS ${TSAN_RTL_CFLAGS})
 list(REMOVE_ITEM TSAN_RTL_DYNAMIC_CFLAGS -fPIE)
 
-set(TSAN_DYNAMIC_LINK_LIBS
-  ${COMPILER_RT_UNWINDER_LINK_LIBS}
-  ${SANITIZER_CXX_ABI_LIBRARIES}
-  ${SANITIZER_COMMON_LINK_LIBS})
+set(TSAN_DYNAMIC_LINK_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBDL dl TSAN_DYNAMIC_LINK_LIBS)
 append_list_if(COMPILER_RT_HAS_LIBM m TSAN_DYNAMIC_LINK_LIBS)

diff  --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt
index 2c7e0f596ff5..3401adff43a2 100644
--- a/compiler-rt/lib/ubsan/CMakeLists.txt
+++ b/compiler-rt/lib/ubsan/CMakeLists.txt
@@ -62,10 +62,7 @@ endif()
 
 set(UBSAN_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
 
-set(UBSAN_DYNAMIC_LIBS
-  ${COMPILER_RT_UNWINDER_LINK_LIBS}
-  ${SANITIZER_CXX_ABI_LIBRARIES}
-  ${SANITIZER_COMMON_LINK_LIBS})
+set(UBSAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
 
 append_list_if(COMPILER_RT_HAS_LIBDL dl UBSAN_DYNAMIC_LIBS)
 append_list_if(COMPILER_RT_HAS_LIBLOG log UBSAN_DYNAMIC_LIBS)


        


More information about the llvm-commits mailing list