diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-07-28 16:38:29 +0300 |
---|---|---|
committer | Amar Tumballi <amar@kadalu.io> | 2020-08-11 04:39:46 +0000 |
commit | 634ce64d0f03ddf3c2a3c05ce21cf9cdcbb763c5 (patch) | |
tree | 2b88b83b0dca81dcd6aa5bf27451fa65b8ea820a /configure.ac | |
parent | 163aa7d2bcbba71107602ab6672da1af53b31726 (diff) |
libglusterfs: annotate synctasks with ThreadSanitizer API
If --enable-tsan is specified and API headers are detected,
annotate synctask context initialization and context switch
with ThreadSanitizer API.
Change-Id: I7ac4085d7ed055448f1fc80df7d59905d129f186
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Fixes: #1400
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 1078ca8925d..1725301d524 100644 --- a/configure.ac +++ b/configure.ac @@ -301,6 +301,21 @@ if test "x$enable_tsan" = "xyes"; then SANITIZER=tsan AC_CHECK_LIB([tsan], [__tsan_init], , [AC_MSG_ERROR([--enable-tsan requires libtsan.so, exiting])]) + if test "x$ac_cv_lib_tsan___tsan_init" = xyes; then + AC_MSG_CHECKING([whether tsan API can be used]) + saved_CFLAGS=${CFLAGS} + CFLAGS="${CFLAGS} -fsanitize=thread" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + [#include <sanitizer/tsan_interface.h>]], + [[__tsan_create_fiber(0)]])], + [TSAN_API=yes], [TSAN_API=no]) + AC_MSG_RESULT([$TSAN_API]) + if test x$TSAN_API = "xyes"; then + AC_DEFINE(HAVE_TSAN_API, 1, [Define if tsan API can be used.]) + fi + CFLAGS=${saved_CFLAGS} + fi GF_CFLAGS="${GF_CFLAGS} -O2 -g -fsanitize=thread -fno-omit-frame-pointer" GF_LDFLAGS="${GF_LDFLAGS} -ltsan" fi |