From e9fdf0d2ecc095ce9f078588c7ce06967e0138b2 Mon Sep 17 00:00:00 2001 From: Federico Pellegrin Date: Fri, 18 Jul 2025 06:12:24 +0200 Subject: [PATCH] perf build: Always disable stack protection for BPF skeleton objects When the clang toolchain has stack protection enabled, the bpf skeletons build fails with: error: A call to built-in function '__stack_chk_fail' is not supported. Since stack-protector makes no sense for the BPF bits, just unconditionally disable it. See also similar case at 878625e1c7a10dfbb1fdaaaae2c4d2a58fbce627 Signed-off-by: Federico Pellegrin Link: https://lore.kernel.org/r/20250718041224.12389-1-fede@evolware.org [ rearrange long lines ] Signed-off-by: Namhyung Kim --- tools/perf/Makefile.perf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 9b51593628c1..e2150acc2c13 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -1249,8 +1249,10 @@ else $(Q)cp "$(VMLINUX_H)" $@ endif -$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(OUTPUT)PERF-VERSION-FILE util/bpf_skel/perf_version.h $(LIBBPF) $(SKEL_OUT)/vmlinux.h | $(SKEL_TMP_OUT) - $(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ +$(SKEL_TMP_OUT)/%.bpf.o: $(OUTPUT)PERF-VERSION-FILE util/bpf_skel/perf_version.h | $(SKEL_TMP_OUT) +$(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h + $(QUIET_CLANG)$(CLANG) -g -O2 -fno-stack-protector --target=bpf \ + $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ -include $(OUTPUT)PERF-VERSION-FILE -include util/bpf_skel/perf_version.h \ -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ -- 2.25.1