Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <fede@evolware.org>
Link: https://lore.kernel.org/r/20250718041224.12389-1-fede@evolware.org
[ rearrange long lines ]
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Federico Pellegrin and committed by
Namhyung Kim
e9fdf0d2 39f473f6

+4 -2
+4 -2
tools/perf/Makefile.perf
··· 1249 1249 $(Q)cp "$(VMLINUX_H)" $@ 1250 1250 endif 1251 1251 1252 - $(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) 1253 - $(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ 1252 + $(SKEL_TMP_OUT)/%.bpf.o: $(OUTPUT)PERF-VERSION-FILE util/bpf_skel/perf_version.h | $(SKEL_TMP_OUT) 1253 + $(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h 1254 + $(QUIET_CLANG)$(CLANG) -g -O2 -fno-stack-protector --target=bpf \ 1255 + $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ 1254 1256 -include $(OUTPUT)PERF-VERSION-FILE -include util/bpf_skel/perf_version.h \ 1255 1257 -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ 1256 1258