summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAdam Buchbinder <abuchbinder@google.com>2017-07-12 13:04:49 -0700
committerDavid Sterba <dsterba@suse.com>2017-07-20 17:43:43 +0200
commit18aed6a623f86f02eb342205d4fc9c7f6928805d (patch)
tree8aba3d8f400256aaf4b90c8f635428dad8d6040e /Makefile
parente2fd79c243f9939851d69d369a588953a6d070f7 (diff)
btrfs-progs: build: Enable ThreadSanitizer, using D=tsan
Tested with clang-3.9. We have to enable PIE, (https://clang.llvm.org/docs/ThreadSanitizer.html) Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 487626f3..b3e2b636 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@
# abort - call abort() on first error (dumps core)
# all - shortcut for all of the above
# asan - enable address sanitizer compiler feature
+# tsan - enable thread sanitizer compiler feature
# ubsan - undefined behaviour sanitizer compiler feature
# bcheck - extended build checks
# W=123 build with warnings (default: off)
@@ -157,6 +158,11 @@ ifneq (,$(findstring asan,$(D)))
DEBUG_CFLAGS_INTERNAL += -fsanitize=address
endif
+ifneq (,$(findstring tsan,$(D)))
+ DEBUG_CFLAGS_INTERNAL += -fsanitize=thread -fPIE
+ LD_FLAGS += -fsanitize=thread -ltsan -pie
+endif
+
ifneq (,$(findstring ubsan,$(D)))
DEBUG_CFLAGS_INTERNAL += -fsanitize=undefined
endif