[compiler-rt] r354153 - Revert "[compiler-rt] Cleanup usage of C++ ABI library"
Jonas Hahnfeld via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 15 10:25:26 PST 2019
Author: hahnfeld
Date: Fri Feb 15 10:25:26 2019
New Revision: 354153
URL: http://llvm.org/viewvc/llvm-project?rev=354153&view=rev
Log:
Revert "[compiler-rt] Cleanup usage of C++ ABI library"
This reverts r354132 because it breaks sanitizer-x86_64-linux:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19915
Modified:
compiler-rt/trunk/CMakeLists.txt
compiler-rt/trunk/cmake/config-ix.cmake
compiler-rt/trunk/lib/asan/CMakeLists.txt
compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt
compiler-rt/trunk/lib/hwasan/CMakeLists.txt
compiler-rt/trunk/lib/scudo/CMakeLists.txt
compiler-rt/trunk/lib/scudo/standalone/tests/CMakeLists.txt
compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt
compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
compiler-rt/trunk/lib/ubsan/CMakeLists.txt
compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -197,38 +197,26 @@ if (cxxabi_supported AND SANITIZER_ALLOW
endif()
pythonize_bool(SANITIZER_CAN_USE_CXXABI)
-macro(handle_default_cxx_lib var)
- if (${var} STREQUAL "default")
- if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
- set(${var}_LIBNAME "libc++")
- set(${var}_SYSTEM 1)
- elseif (FUCHSIA)
- set(${var}_LIBNAME "libc++")
- set(${var}_INTREE 1)
- else()
- set(${var}_LIBNAME "libstdc++")
- set(${var}_SYSTEM 1)
- endif()
- else()
- set(${var}_LIBNAME "${${var}}")
- set(${var}_SYSTEM 1)
- endif()
-endmacro()
-
-# This is either directly the C++ ABI library or the full C++ library
-# which pulls in the ABI transitively.
set(SANITIZER_CXX_ABI "default" CACHE STRING
"Specify C++ ABI library to use.")
-set(CXXABIS none default libstdc++ libc++ libcxxabi)
+set(CXXABIS none default libstdc++ libc++)
set_property(CACHE SANITIZER_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
-handle_default_cxx_lib(SANITIZER_CXX_ABI)
-# This needs to be a full C++ library for linking gtest and unit tests.
-set(SANITIZER_TEST_CXX "default" CACHE STRING
- "Specify C++ library to use for tests.")
-set(CXXLIBS none default libstdc++ libc++)
-set_property(CACHE SANITIZER_TEST_CXX PROPERTY STRINGS ;${CXXLIBS})
-handle_default_cxx_lib(SANITIZER_TEST_CXX)
+if (SANITIZER_CXX_ABI STREQUAL "default")
+ if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ set(SANITIZER_CXX_ABI_LIBNAME "libc++")
+ set(SANITIZER_CXX_ABI_SYSTEM 1)
+ elseif (FUCHSIA)
+ set(SANITIZER_CXX_ABI_LIBNAME "libc++")
+ set(SANITIZER_CXX_ABI_INTREE 1)
+ else()
+ set(SANITIZER_CXX_ABI_LIBNAME "libstdc++")
+ set(SANITIZER_CXX_ABI_SYSTEM 1)
+ endif()
+else()
+ set(SANITIZER_CXX_ABI_LIBNAME "${SANITIZER_CXX_ABI}")
+ set(SANITIZER_CXX_ABI_SYSTEM 1)
+endif()
set(DEFAULT_SANITIZER_USE_STATIC_LLVM_UNWINDER OFF)
if (FUCHSIA)
@@ -424,36 +412,26 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuch
list(APPEND SANITIZER_COMMON_LINK_LIBS zircon)
endif()
-macro(append_libcxx_libs var)
- if (${var}_INTREE)
+if (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libc++")
+ if (SANITIZER_CXX_ABI_INTREE)
if (SANITIZER_USE_STATIC_LLVM_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
- list(APPEND ${var}_LIBRARIES unwind_static)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY unwind_static)
elseif (TARGET unwind_shared OR HAVE_LIBUNWIND)
- list(APPEND ${var}_LIBRARIES unwind_shared)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY unwind_shared)
endif()
if (SANITIZER_USE_STATIC_CXX_ABI AND (TARGET cxxabi_static OR HAVE_LIBCXXABI))
- list(APPEND ${var}_LIBRARIES cxxabi_static)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY cxxabi_static)
elseif (TARGET cxxabi_shared OR HAVE_LIBCXXABI)
- list(APPEND ${var}_LIBRARIES cxxabi_shared)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY cxxabi_shared)
endif()
else()
- append_list_if(COMPILER_RT_HAS_LIBCXX c++ ${var}_LIBRARIES)
+ append_list_if(COMPILER_RT_HAS_LIBCXX c++ SANITIZER_CXX_ABI_LIBRARY)
endif()
-endmacro()
-
-if (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libc++")
- append_libcxx_libs(SANITIZER_CXX_ABI)
elseif (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libcxxabi")
- list(APPEND SANITIZER_CXX_ABI_LIBRARIES "c++abi")
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY "c++abi")
elseif (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libstdc++")
- append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ SANITIZER_CXX_ABI_LIBRARIES)
-endif()
-
-if (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libc++")
- append_libcxx_libs(SANITIZER_TEST_CXX)
-elseif (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libstdc++")
- append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ SANITIZER_TEST_CXX_LIBRARIES)
+ append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ SANITIZER_CXX_ABI_LIBRARY)
endif()
# Warnings to turn off for all libraries, not just sanitizers.
Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Fri Feb 15 10:25:26 2019
@@ -120,8 +120,6 @@ check_library_exists(m pow "" COMPILER_R
check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
check_library_exists(execinfo backtrace "" COMPILER_RT_HAS_LIBEXECINFO)
-find_package(Threads)
-
# Look for terminfo library, used in unittests that depend on LLVMSupport.
if(LLVM_ENABLE_TERMINFO)
foreach(library terminfo tinfo curses ncurses ncursesw)
Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -92,7 +92,7 @@ append_list_if(COMPILER_RT_HAS_FTLS_MODE
-ftls-model=initial-exec ASAN_DYNAMIC_CFLAGS)
append_list_if(MSVC /DEBUG ASAN_DYNAMIC_LINK_FLAGS)
-set(ASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
+set(ASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY} ${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)
Modified: compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -17,11 +17,10 @@ set_target_properties(FuzzerUnitTests PR
set(LIBFUZZER_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_LINK_FLAGS})
list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS --driver-mode=g++)
-foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
- list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -l${lib})
-endforeach()
-if(NOT WIN32)
- list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT})
+if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lc++ -lpthread)
+elseif(NOT WIN32)
+ list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -lstdc++ -lpthread)
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND COMPILER_RT_LIBCXX_PATH)
Modified: compiler-rt/trunk/lib/hwasan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/hwasan/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/hwasan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/hwasan/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -55,7 +55,7 @@ append_list_if(COMPILER_RT_HAS_FTLS_MODE
-ftls-model=initial-exec HWASAN_DYNAMIC_CFLAGS)
append_list_if(MSVC /DEBUG HWASAN_DYNAMIC_LINK_FLAGS)
-set(HWASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
+set(HWASAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY} ${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)
Modified: compiler-rt/trunk/lib/scudo/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/scudo/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -37,7 +37,7 @@ if (FUCHSIA)
list(APPEND SCUDO_CFLAGS -nostdinc++)
list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -nostdlib++)
else()
- list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES})
+ list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY})
list(APPEND SCUDO_OBJECT_LIBS
RTSanitizerCommonCoverage
RTSanitizerCommonSymbolizer
Modified: compiler-rt/trunk/lib/scudo/standalone/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/standalone/tests/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/standalone/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/scudo/standalone/tests/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -15,10 +15,7 @@ set(SCUDO_UNITTEST_CFLAGS
set(SCUDO_TEST_ARCH ${SCUDO_SUPPORTED_ARCH})
# gtests requires c++
-set(LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT})
-foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
- list(APPEND LINK_FLAGS -l${lib})
-endforeach()
+set(LINK_FLAGS -lstdc++ -pthread)
set(TEST_HEADERS)
foreach (header ${SCUDO_HEADERS})
Modified: compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/dd/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -10,7 +10,7 @@ set(DD_SOURCES
dd_interceptors.cc
)
-set(DD_LINKLIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
+set(DD_LINKLIBS ${SANITIZER_CXX_ABI_LIBRARY} ${SANITIZER_COMMON_LINK_LIBS})
append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS)
append_list_if(COMPILER_RT_HAS_LIBRT rt DD_LINKLIBS)
Modified: compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/tests/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -14,12 +14,6 @@ set(TSAN_UNITTEST_CFLAGS
-DGTEST_HAS_RTTI=0)
set(TSAN_TEST_ARCH ${TSAN_SUPPORTED_ARCH})
-
-set(LINK_FLAGS)
-foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
- list(APPEND LINK_FLAGS -l${lib})
-endforeach()
-
if(APPLE)
# Create a static library for test dependencies.
@@ -39,12 +33,12 @@ if(APPLE)
darwin_filter_host_archs(TSAN_SUPPORTED_ARCH TSAN_TEST_ARCH)
list(APPEND TSAN_UNITTEST_CFLAGS ${DARWIN_osx_CFLAGS})
+ set(LINK_FLAGS "-lc++")
list(APPEND LINK_FLAGS ${DARWIN_osx_LINK_FLAGS})
add_weak_symbols("ubsan" LINK_FLAGS)
add_weak_symbols("sanitizer_common" LINK_FLAGS)
else()
- list(APPEND LINK_FLAGS -fsanitize=thread)
- list(APPEND LINK_FLAGS -lm)
+ set(LINK_FLAGS "-fsanitize=thread;-lstdc++;-lm")
endif()
set(TSAN_RTL_HEADERS)
Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -52,7 +52,7 @@ set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CF
append_rtti_flag(ON UBSAN_CXXFLAGS)
append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CXXFLAGS)
-set(UBSAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARIES} ${SANITIZER_COMMON_LINK_LIBS})
+set(UBSAN_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY} ${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)
Modified: compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/tests/CMakeLists.txt?rev=354153&r1=354152&r2=354153&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/tests/CMakeLists.txt Fri Feb 15 10:25:26 2019
@@ -47,7 +47,8 @@ function(get_xray_lib_for_arch arch lib)
endfunction()
set(XRAY_TEST_ARCH ${XRAY_SUPPORTED_ARCH})
-set(XRAY_UNITTEST_LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT})
+set(XRAY_UNITTEST_LINK_FLAGS
+ ${CMAKE_THREAD_LIBS_INIT})
if (NOT APPLE)
# Needed by LLVMSupport.
@@ -79,9 +80,7 @@ if (NOT APPLE)
append_list_if(COMPILER_RT_HAS_LIBEXECINFO -lexecinfo XRAY_UNITTEST_LINK_FLAGS)
endif()
-foreach(lib ${SANITIZER_TEST_CXX_LIBRARIES})
- list(APPEND XRAY_UNITTEST_LINK_FLAGS -l${lib})
-endforeach()
+list(APPEND XRAY_UNITTEST_LINK_FLAGS -l${SANITIZER_CXX_ABI_LIBRARY})
macro(add_xray_unittest testname)
cmake_parse_arguments(TEST "" "" "SOURCES;HEADERS" ${ARGN})
More information about the llvm-commits
mailing list