[PATCH v1 05/10] perf build: Enable additional Clang thread-safety flags
From: Ian Rogers
Date: Tue Oct 13 2026 - 17:48:22 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.
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/Makefile.config | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 39442577418e..d536203ff42f 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -64,7 +64,10 @@ 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 -Wthread-safety-pointer -Wthread-safety-beta
+ ifeq ($(shell $(CC) -Werror -fexperimental-late-parse-attributes -E -x c /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.385.gd3acb90ef8-goog