summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindSanitizers.cmake
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2018-10-22 08:06:38 +0200
committerKefu Chai <kchai@redhat.com>2018-10-22 08:40:03 +0200
commitfd58e5d4ad2035ce66b6a3de8a0967e75cb985de (patch)
treed71dc6aa2abac522482778570fc36619b56edd0f /cmake/modules/FindSanitizers.cmake
parentceph.in: extract get_cmake_variables() (diff)
downloadceph-fd58e5d4ad2035ce66b6a3de8a0967e75cb985de.tar.xz
ceph-fd58e5d4ad2035ce66b6a3de8a0967e75cb985de.zip
cmake,ceph.in: preload libasan if WITH_ASAN
we need to preload libasan.so as the python exectuable is not likely to be compiled with ASan enabled. see: https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso#asan-and-ld_preload just to ease the use of ASan, for fine-tuned behaviour, use `ASAN_OPTIONS`. Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'cmake/modules/FindSanitizers.cmake')
-rw-r--r--cmake/modules/FindSanitizers.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmake/modules/FindSanitizers.cmake b/cmake/modules/FindSanitizers.cmake
index 648edc67f50..652ee659c9b 100644
--- a/cmake/modules/FindSanitizers.cmake
+++ b/cmake/modules/FindSanitizers.cmake
@@ -29,6 +29,15 @@ foreach(component ${Sanitizers_FIND_COMPONENTS})
list(APPEND Sanitizers_OPTIONS "${Sanitizers_${component}_COMPILE_OPTIONS}")
endforeach()
+if(Sanitizers_address_COMPILE_OPTIONS OR Sanitizers_leak_COMPILE_OPTIONS)
+ # ASAN_LIBRARY will be read by ceph.in to preload the asan library
+ find_library(ASAN_LIBRARY
+ NAMES
+ libasan.so.5
+ libasan.so.4
+ libasan.so.3)
+endif()
+
if(Sanitizers_OPTIONS)
string(REPLACE ";" ","
Sanitizers_COMPILE_OPTIONS