aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2025-06-25 13:23:08 -0700
committerNamhyung Kim <namhyung@kernel.org>2025-06-26 10:51:40 -0700
commit55a18d2f3ff79c9082225f44e0abbaea6286bf99 (patch)
treec58eec952c37037e17ccdff54361a864358247f8 /tools/perf
parentperf top: populate PMU capabilities data in perf_env (diff)
downloadlinux-55a18d2f3ff79c9082225f44e0abbaea6286bf99.tar.gz
linux-55a18d2f3ff79c9082225f44e0abbaea6286bf99.zip
perf build: enable -fno-strict-aliasing
perf pulls in code from kernel headers that assumes it is being built with -fno-strict-aliasing, namely put_unaligned_*() from <linux/unaligned.h> which write the data using packed structs that lack the may_alias attribute. Enable -fno-strict-aliasing to prevent miscompilations in sha1.c which would otherwise occur due to this issue. Signed-off-by: Eric Biggers <ebiggers@kernel.org> Reviewed-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250625202311.23244-2-ebiggers@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile.config4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 24736b0bbb30..70a3e771c7c0 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -19,6 +19,10 @@ detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
+# This is required because the kernel is built with this and some of the code
+# borrowed from kernel headers depends on it, e.g. put_unaligned_*().
+CFLAGS += -fno-strict-aliasing
+
# Enabled Wthread-safety analysis for clang builds.
ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -Wthread-safety