From 634ce64d0f03ddf3c2a3c05ce21cf9cdcbb763c5 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 28 Jul 2020 16:38:29 +0300 Subject: 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 Fixes: #1400 --- configure.ac | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 1078ca8925..1725301d52 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 ]], + [[__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 -- cgit