Commit 42eb64e6 authored by Daniel Black's avatar Daniel Black

MDEV-34996 Buildbot MSAN options should be in server

All the options that where in buildbot, should
be in the server making it accessible to all
without any special invocation.

If WITH_MSAN=ON, we want to make sure that the
compiler options are supported and it will result
in an error if not supported.

We make the -WITH_MSAN=ON append -stdlib=libc++
to the CXX_FLAGS if supported.

With SECURITY_HARDENING options the bootstrap
currently crashes, so for now, we disable SECRUITY_HARDENING
if there is MSAN enable.

Option WITH_DBUG_TRACE has no effect in MSAN builds.
parent ad5b9c20
...@@ -244,6 +244,19 @@ ENDIF() ...@@ -244,6 +244,19 @@ ENDIF()
OPTION(WITH_MSAN "Enable memory sanitizer" OFF) OPTION(WITH_MSAN "Enable memory sanitizer" OFF)
IF (WITH_MSAN) IF (WITH_MSAN)
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
IF(NOT (have_C__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE
AND have_CXX__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE))
MESSAGE(FATAL_ERROR "Compiler doesn't support -fsanitize=memory flags")
ENDIF()
MY_CHECK_CXX_COMPILER_FLAG("-stdlib=libc++")
IF(NOT have_CXX__stdlib_libc__)
MESSAGE(FATAL_ERROR "C++ Compiler requires support for -stdlib=libc++")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory" DEBUG RELWITHDEBINFO)
IF(NOT HAVE_LINK_FLAG__fsanitize_memory)
MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags")
ENDIF()
ENDIF() ENDIF()
OPTION(WITH_GPROF "Enable profiling with gprof" OFF) OPTION(WITH_GPROF "Enable profiling with gprof" OFF)
...@@ -257,7 +270,7 @@ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO) ...@@ -257,7 +270,7 @@ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO)
# enable security hardening features, like most distributions do # enable security hardening features, like most distributions do
# in our benchmarks that costs about ~1% of performance, depending on the load # in our benchmarks that costs about ~1% of performance, depending on the load
OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON) OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON)
IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF) IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF AND NOT WITH_MSAN)
# security-enhancing flags # security-enhancing flags
MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC")
MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now") MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment