From 5a796a86d70e9be041fa8d785d85b0441572b399 Mon Sep 17 00:00:00 2001 From: brain5lug Date: Mon, 3 Oct 2016 23:24:22 +0300 Subject: [PATCH 1/2] thread sanitizer configuration option have been added --- build/CMakeLists.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 95f223ef..00048942 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -16,7 +16,8 @@ option(WITH_UPNP "Include support for UPnP client" OFF) option(WITH_PCH "Use precompiled header" OFF) option(WITH_GUI "Include GUI (currently MS Windows only)" ON) option(WITH_MESHNET "Build for cjdns test network" OFF) -option(WITH_ADDRSANITIZER "Build with address sanitizer (linux only)" OFF) +option(WITH_ADDRSANITIZER "Build with address sanitizer unix only" OFF) +option(WITH_THREADSANITIZER "Build with thread sanitizer unix only" OFF) # paths set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" ) @@ -190,10 +191,22 @@ if (WITH_ADDRSANITIZER) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" ) set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" ) else () - error ("MSVC does not support address sanitizer option") + message( SEND_ERROR "MSVC does not support address sanitizer option") endif() endif() +if (WITH_THREADSANITIZER) + if (WITH_ADDRSANITIZER) + message( FATAL_ERROR "thread sanitizer option cannot be combined with address sanitizer") + elseif (NOT MSVC) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread" ) + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread" ) + else () + message( SEND_ERROR "MSVC does not support address sanitizer option") + endif() +endif() + + # libraries # TODO: once CMake 3.1+ becomes mainstream, see e.g. http://stackoverflow.com/a/29871891/673826 # use imported Threads::Threads instead @@ -347,6 +360,7 @@ message(STATUS " UPnP : ${WITH_UPNP}") message(STATUS " PCH : ${WITH_PCH}") message(STATUS " MESHNET : ${WITH_MESHNET}") message(STATUS " ADDRSANITIZER : ${WITH_ADDRSANITIZER}") +message(STATUS " THEADSANITIZER : ${WITH_THREADSANITIZER}") message(STATUS "---------------------------------------") #Handle paths nicely From 77ec4b5cad20ae6af5f89744d97337369cf6326e Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 9 Oct 2016 14:57:15 -0400 Subject: [PATCH 2/2] added warning --- Makefile.mingw | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.mingw b/Makefile.mingw index 85b6b455..2ab918b4 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -37,6 +37,7 @@ ifeq ($(USE_WIN32_APP), yes) DAEMON_OBJS += $(patsubst %.rc,obj/%.o,$(DAEMON_RC)) endif +# don't change following line to ifeq ($(USE_AESNI),yes) !!! ifeq ($(USE_AESNI),1) CPU_FLAGS = -maes -DAESNI else