[PATCH RFC 33/33] kbuild: clang: Unconditionally enable thread-safety checking

Bart Van Assche posted 33 patches 10 months, 1 week ago
[PATCH RFC 33/33] kbuild: clang: Unconditionally enable thread-safety checking
Posted by Bart Van Assche 10 months, 1 week ago
Enable thread-safety checks for arm64 and x86. Do not enable it for other
architectures yet - this will be done later. Disable thread-safety checking
for staging drivers. Fixing thread-safety bugs in staging drivers will have
to be done when these drivers come out of staging.

Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/staging/Makefile | 2 ++
 scripts/Makefile.clang   | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index e681e403509c..4eafda5b95eb 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for staging directory
 
+KBUILD_CFLAGS += -Wno-thread-safety
+
 obj-y				+= media/
 obj-$(CONFIG_RTL8723BS)		+= rtl8723bs/
 obj-$(CONFIG_OCTEON_ETHERNET)	+= octeon/
diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang
index 2435efae67f5..d27688bddd95 100644
--- a/scripts/Makefile.clang
+++ b/scripts/Makefile.clang
@@ -36,5 +36,8 @@ CLANG_FLAGS	+= -Werror=unknown-warning-option
 CLANG_FLAGS	+= -Werror=ignored-optimization-argument
 CLANG_FLAGS	+= -Werror=option-ignored
 CLANG_FLAGS	+= -Werror=unused-command-line-argument
+
+CLANG_FLAGS	+= -Wthread-safety
+
 KBUILD_CPPFLAGS	+= $(CLANG_FLAGS)
 export CLANG_FLAGS