diff options
author | Eugene Kosov <claprix@yandex.ru> | 2019-01-29 14:45:51 +0300 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2019-03-11 13:37:19 +0400 |
commit | 2a2ab121b0f65cdc4b104ec763d23f1b7035a644 (patch) | |
tree | a0acf13574efb72a4a7dd9f7376a02dc856daff8 /CMakeLists.txt | |
parent | 04150218408741aa4599d90aefadb4cb6f15029c (diff) | |
download | mariadb-git-2a2ab121b0f65cdc4b104ec763d23f1b7035a644.tar.gz |
MDEV-17703 Add WITH_UBSAN switch to CMake similar to WITH_ASAN
This can be useful:
UBSAN_OPTIONS=log_path=/some/path
clang users may want to increase stack size in include/my_pthread.h or enable
some optimizations
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 358f73ccfdd..3bfbcc4995d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,6 +214,15 @@ IF (WITH_ASAN) ENDIF() ENDIF() +OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF) +IF (WITH_UBSAN) + IF(SECURITY_HARDENED) + MESSAGE(FATAL_ERROR "WITH_UBSAN and SECURITY_HARDENED are mutually exclusive") + ENDIF() + MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined" DEBUG RELWITHDEBINFO) +ENDIF() + + # 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") |