summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2021-03-24 13:15:03 +0300
committerEugene Kosov <claprix@yandex.ru>2021-03-26 16:29:58 +0300
commitdfae51de361a1604a97d93181df5e8669a1c2f85 (patch)
tree547a69ebc2f0915de2621145de7ff07946e3ad72
parenta6d66fe75e9ce3ea2c43c311d0c8298fecbacff3 (diff)
downloadmariadb-git-dfae51de361a1604a97d93181df5e8669a1c2f85.tar.gz
MDEV-25238 add support for -fsanitize-address-use-after-scope
Use like this: cmake -DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON
-rw-r--r--CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 466b2a5bc3a..ab5959da7b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,7 +202,13 @@ IF (WITH_ASAN)
SET(HAVE_C_FSANITIZE ${have_C__fsanitize_address__fPIC})
SET(HAVE_CXX_FSANITIZE ${have_CXX__fsanitize_address__fPIC})
IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE)
+ OPTION(WITH_ASAN_SCOPE "Enable -fsanitize-address-use-after-scope" OFF)
SET(WITH_ASAN_OK 1)
+ IF(WITH_ASAN_SCOPE)
+ MY_CHECK_AND_SET_COMPILER_FLAG(
+ "-fsanitize=address -fsanitize-address-use-after-scope"
+ DEBUG RELWITHDEBINFO)
+ ENDIF()
ELSE()
# older versions of clang
MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -fPIC"