[PATCH v3 05/17] perf build: Enable additional Clang thread-safety flags
From: Ian Rogers
Date: Fri Oct 16 2026 - 13:33:05 EST
Align tools/perf's Clang thread-safety flags with the kernel's
scripts/Makefile.context-analysis by adding -Wthread-safety-pointer,
-Wthread-safety-beta, and (when supported by the compiler)
-fexperimental-late-parse-attributes.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/Makefile.config | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 39442577418e..ce746b12f901 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -64,7 +64,13 @@ ifeq ($(CC_NO_CLANG), 0)
endif
# Enabled Wthread-safety analysis for clang builds.
- CFLAGS += -Wthread-safety -DWARN_CONTEXT_ANALYSIS
+ CFLAGS += -DWARN_CONTEXT_ANALYSIS -Wthread-safety
+ ifeq ($(shell $(CC) -Werror -Wthread-safety-pointer -Wthread-safety-beta -c -x c /dev/null -o /dev/null >/dev/null 2>&1 && echo 1), 1)
+ CFLAGS += -Wthread-safety-pointer -Wthread-safety-beta
+ endif
+ ifeq ($(shell $(CC) -Werror -fexperimental-late-parse-attributes -c -x c /dev/null -o /dev/null >/dev/null 2>&1 && echo 1), 1)
+ CFLAGS += -fexperimental-late-parse-attributes
+ endif
endif
include $(srctree)/tools/scripts/Makefile.arch
--
2.56.0.212.g129ede20d9-goog