# Build for the ThreadSanitizer runtime support library.

include_directories(..)

set(TSAN_CFLAGS
  ${SANITIZER_COMMON_CFLAGS}
  -fno-rtti)
# FIXME: Add support for compile flags:
#   -Wframe-larger-than=512,
#   -Wglobal-constructors,
#   --sysroot=.

if("${CMAKE_BUILD_TYPE}" EQUAL "Release")
  set(TSAN_COMMON_DEFINITIONS DEBUG=0)
else()
  set(TSAN_COMMON_DEFINITIONS DEBUG=1)
endif()

add_subdirectory(rtl)

if(LLVM_INCLUDE_TESTS)
  add_subdirectory(tests)
endif()
add_subdirectory(lit_tests)

# Build for the ThreadSanitizer runtime support library.

include_directories(..)

# SANITIZER_COMMON_CFLAGS contains -fPIC, but it's performance-critical for
# TSan runtime to be built with -fPIE to reduce the number of register spills.
set(TSAN_CFLAGS
  ${SANITIZER_COMMON_CFLAGS}
  -fPIE
  -fno-rtti)
# FIXME: Add support for compile flags:
#   -Wframe-larger-than=512,
#   -Wglobal-constructors,
#   --sysroot=.

if("${CMAKE_BUILD_TYPE}" EQUAL "Release")
  set(TSAN_COMMON_DEFINITIONS DEBUG=0)
else()
  set(TSAN_COMMON_DEFINITIONS DEBUG=1)
endif()

add_subdirectory(rtl)

if(LLVM_INCLUDE_TESTS)
  add_subdirectory(tests)
endif()
add_subdirectory(lit_tests)

Build TSan runtime with -fPIE. This removes all register spills from the performance-critical __tsan_{read,write}{1,2,4,8} functions when the host compiler is GCC.
[TSan] Build TSan runtime with -fPIE.
This removes all register spills from the performance-critical __tsan_{read,write}{1,2,4,8} functions when the host compiler is GCC.


git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@178340 91177308-0d34-0410-b5e6-96231b3b80d8
