Add make_bpf_skel_clang (CLANG=clang BPF_GCC=) and make_bpf_skel_bpf_gcc (BPF_GCC=bpf-gcc CLANG=) targets to tools/perf/tests/make when the corresponding compiler and BPF skeleton dependencies are available on the host. Verify with 'perf check -q feature bpf_skeletons' that BPF skeleton support is enabled for both targets and disabled for make_no_bpf_skel. Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers --- tools/perf/tests/make | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 7524de522802..4e66b93cf12c 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make @@ -78,6 +78,8 @@ make_extra_tests := EXTRA_TESTS=1 make_no_jevents := NO_JEVENTS=1 make_jevents_all := JEVENTS_ARCH=all make_no_bpf_skel := BUILD_BPF_SKEL=0 +make_bpf_skel_clang := CLANG=clang BPF_GCC= +make_bpf_skel_bpf_gcc := BPF_GCC=bpf-gcc CLANG= make_gen_vmlinux_h := GEN_VMLINUX_H=1 make_no_python_module := NO_PYTHON_MODULE=1 make_no_scripts := NO_PYTHON_MODULE=1 @@ -142,6 +144,20 @@ have_libllvm := $(shell printf '#include \n#includ $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null) >/dev/null 2>&1 && echo y) endif +have_bpf_skel_deps := $(shell printf '#include \n#include \n#include \n#include \nint main(){return 0;}\n' | \ + $(CC) -x c -I$(srctree)/tools/include/uapi - -o /dev/null -lelf -lz -lcrypto >/dev/null 2>&1 && echo y) + +ifneq ($(have_bpf_skel_deps),) +ifneq ($(call has,clang),) +have_clang_bpf := $(shell printf '#if (__clang_major__ < 12) || (__clang_major__ == 12 && __clang_minor__ == 0 && __clang_patchlevel__ < 1)\n#error "old"\n#endif\n' | \ + clang -S -g --target=bpf -x c - -o /dev/null >/dev/null 2>&1 && echo y) +endif +ifneq ($(call has,bpf-gcc),) +have_bpf_gcc := $(shell printf '#if __GNUC__ < 14\n#error "old"\n#endif\n' | \ + bpf-gcc -E -x c - >/dev/null 2>&1 && echo y) +endif +endif + # $(run) contains all available tests run := make_pure # Targets 'clean all' can be run together only through top level @@ -173,6 +189,12 @@ run += make_extra_tests run += make_no_jevents run += make_jevents_all run += make_no_bpf_skel +ifneq ($(have_clang_bpf),) +run += make_bpf_skel_clang +endif +ifneq ($(have_bpf_gcc),) +run += make_bpf_skel_bpf_gcc +endif run += make_gen_vmlinux_h run += make_no_python_module run += make_no_scripts @@ -313,6 +335,13 @@ test_make_clang_nondistro := $(test_make_clang) test_make_clang_nondistro_O := $(test_make_clang_O) endif +test_make_no_bpf_skel := test -x $(PERF_O)/perf && ! $(PERF_O)/perf check -q feature bpf_skeletons +test_make_no_bpf_skel_O := test -x $$TMP_O/perf && ! $$TMP_O/perf check -q feature bpf_skeletons +test_make_bpf_skel_clang := test -x $(PERF_O)/perf && $(PERF_O)/perf check -q feature bpf_skeletons +test_make_bpf_skel_clang_O := test -x $$TMP_O/perf && $$TMP_O/perf check -q feature bpf_skeletons +test_make_bpf_skel_bpf_gcc := test -x $(PERF_O)/perf && $(PERF_O)/perf check -q feature bpf_skeletons +test_make_bpf_skel_bpf_gcc_O := test -x $$TMP_O/perf && $$TMP_O/perf check -q feature bpf_skeletons + test_make_python_perf_so_O := test -f $$TMP_O/python/perf.so test_make_perf_o_O := test -f $$TMP_O/perf.o test_make_util_map_o_O := test -f $$TMP_O/util/map.o -- 2.56.0.385.gd3acb90ef8-goog