tsan: replace deadlock detector custom build script with cmake file

llvm-svn: 202708
This commit is contained in:
Dmitry Vyukov 2014-03-03 13:15:12 +00:00
parent 1d191909a8
commit 530fb9414b
3 changed files with 38 additions and 45 deletions

View File

@ -29,6 +29,7 @@ if(NOT LLVM_USE_SANITIZER)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID)
# ThreadSanitizer and MemorySanitizer are supported on Linux only.
add_subdirectory(tsan)
add_subdirectory(tsan/dd)
add_subdirectory(msan)
add_subdirectory(msandr)
add_subdirectory(dfsan)

View File

@ -0,0 +1,37 @@
# Build for the experimental deadlock detector runtime library.
include_directories(../..)
set(DD_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_no_rtti_flag(DD_CFLAGS)
if("${CMAKE_BUILD_TYPE}" EQUAL "Release")
set(DD_COMMON_DEFINITIONS DEBUG=0)
else()
set(DD_COMMON_DEFINITIONS DEBUG=1)
endif()
set(DD_SOURCES
dd_rtl.cc
dd_interceptors.cc
)
set(DD_HEADERS
dd_rtl.h
)
add_custom_target(dd)
# Deadlock detector is currently supported on 64-bit Linux only.
if(CAN_TARGET_x86_64 AND UNIX AND NOT APPLE)
set(arch "x86_64")
add_compiler_rt_static_runtime(clang_rt.dd-${arch} ${arch}
SOURCES ${DD_SOURCES}
$<TARGET_OBJECTS:RTInterception.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
CFLAGS ${DD_CFLAGS}
DEFS ${DD_COMMON_DEFINITIONS})
endif()
add_dependencies(compiler-rt dd)

View File

@ -1,45 +0,0 @@
#!/bin/bash
set -e
SRCS="
dd_rtl.cc
dd_interceptors.cc
../../sanitizer_common/sanitizer_allocator.cc
../../sanitizer_common/sanitizer_common.cc
../../sanitizer_common/sanitizer_deadlock_detector1.cc
../../sanitizer_common/sanitizer_flags.cc
../../sanitizer_common/sanitizer_libc.cc
../../sanitizer_common/sanitizer_printf.cc
../../sanitizer_common/sanitizer_suppressions.cc
../../sanitizer_common/sanitizer_thread_registry.cc
../../sanitizer_common/sanitizer_posix.cc
../../sanitizer_common/sanitizer_posix_libcdep.cc
../../sanitizer_common/sanitizer_procmaps_linux.cc
../../sanitizer_common/sanitizer_linux.cc
../../sanitizer_common/sanitizer_linux_libcdep.cc
../../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
../../sanitizer_common/sanitizer_stackdepot.cc
../../sanitizer_common/sanitizer_stacktrace.cc
../../sanitizer_common/sanitizer_stacktrace_libcdep.cc
../../sanitizer_common/sanitizer_symbolizer.cc
../../sanitizer_common/sanitizer_symbolizer_libcdep.cc
../../sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
../../sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
../../interception/interception_linux.cc
"
FLAGS=" -I../.. -I../../sanitizer_common -I../../interception -Wall -fno-exceptions -fno-rtti -DSANITIZER_USE_MALLOC"
if [ "$DEBUG" == "" ]; then
FLAGS+=" -DDEBUG=0 -O3 -fomit-frame-pointer"
else
FLAGS+=" -DDEBUG=1 -g"
fi
rm -f dd.cc
for F in $SRCS; do
g++ $F -c -o dd.o $FLAGS
cat $F >> dd.cc
done
g++ dd.cc -c -o dd.o $FLAGS