Browse Source

add TSAN option to cmake (#444)

* add TSAN option to cmake

* disable security hardened build when TSAN is on

* handling user-specified SECURITY_HARDEDED option
pull/448/head
Eugene Kosov 8 years ago
committed by Sergey Vojtovich
parent
commit
8d64da8570
  1. 10
      CMakeLists.txt

10
CMakeLists.txt

@ -204,6 +204,15 @@ IF (WITH_ASAN)
ENDIF()
ENDIF()
OPTION(WITH_TSAN "Enable thread sanitizer" OFF)
IF (WITH_TSAN)
IF(SECURITY_HARDENED)
MESSAGE(FATAL_ERROR "WITH_TSAN and SECURITY_HARDENED are mutually exclusive")
ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=thread" DEBUG RELWITHDEBINFO)
ENDIF()
IF(NOT WITH_TSAN)
# enable security hardening features, like most distributions do
# in our benchmarks that costs about ~1% of performance, depending on the load
IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "4.6")
@ -219,6 +228,7 @@ IF(SECURITY_HARDENED)
MY_CHECK_AND_SET_COMPILER_FLAG("-fstack-protector --param=ssp-buffer-size=4")
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
ENDIF()
ENDIF()
# Always enable debug sync for debug builds.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")

Loading…
Cancel
Save