[PATCH 1/2] configure: add support for thread sanitizer (--enable-tsan)
Matthias Maennich
maennich@google.com
Thu Mar 12 11:31:57 GMT 2020
Similarly to asan and ubsan, add support for tsan conditionally at
configure time. This allows us to track down race conditions etc.
* configure.ac: Add configure options for -fsanitize=thread
Signed-off-by: Matthias Maennich <maennich@google.com>
---
configure.ac | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/configure.ac b/configure.ac
index ba800a72ac7a..50a50c6c8932 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,6 +120,12 @@ AC_ARG_ENABLE(asan,
ENABLE_ASAN=$enableval,
ENABLE_ASAN=no)
+AC_ARG_ENABLE(tsan,
+ AS_HELP_STRING([--enable-tsan=yes|no],
+ [enable the support of building with -fsanitize=thread)]),
+ ENABLE_TSAN=$enableval,
+ ENABLE_TSAN=no)
+
AC_ARG_ENABLE(ubsan,
AS_HELP_STRING([--enable-ubsan=yes|no],
[enable the support of building with -fsanitize=undefined)]),
@@ -614,6 +620,11 @@ if test x$ENABLE_ASAN = xyes; then
CXXFLAGS="$CXXFLAGS -fsanitize=address"
fi
+if test x$ENABLE_TSAN = xyes; then
+ CFLAGS="$CFLAGS -fsanitize=thread"
+ CXXFLAGS="$CXXFLAGS -fsanitize=thread"
+fi
+
if test x$ENABLE_UBSAN = xyes; then
CFLAGS="$CFLAGS -fsanitize=undefined"
CXXFLAGS="$CXXFLAGS -fsanitize=undefined"
@@ -907,6 +918,7 @@ AC_MSG_NOTICE([
Enable python 3 : ${ENABLE_PYTHON3}
Enable running tests under Valgrind : ${enable_valgrind}
Enable build with -fsanitize=address : ${ENABLE_ASAN}
+ Enable build with -fsanitize=thread : ${ENABLE_TSAN}
Enable build with -fsanitize=undefined : ${ENABLE_UBSAN}
Generate html apidoc : ${ENABLE_APIDOC}
Generate html manual : ${ENABLE_MANUAL}
--
2.25.1.481.gfbce0eb801-goog
More information about the Libabigail
mailing list