mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	 "Jose E . Marchesi" <jose.marchesi@oracle.com>,
	David Faust <david.faust@oracle.com>,
	 Cupertino Miranda <cupertino.miranda@oracle.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Jiri Olsa <jolsa@kernel.org>,
	 Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	 James Clark <james.clark@linaro.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	 Eduard Zingerman <eddyz87@gmail.com>,
	Yonghong Song <yonghong.song@linux.dev>,
	 linux-perf-users@vger.kernel.org, bpf@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: [PATCH v1 2/2] perf test make: Add BPF skeleton build tests for clang and bpf-gcc
Date: Tue, 13 Oct 2026 15:16:43 -0700	[thread overview]
Message-ID: <20261013221643.1815686-3-irogers@google.com> (raw)
In-Reply-To: <20261013221643.1815686-1-irogers@google.com>

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 <irogers@google.com>
---
 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 <llvm/Support/ManagedStatic.h>\n#includ
 		$(shell $(LLVM_CONFIG) --system-libs 2>/dev/null) >/dev/null 2>&1 && echo y)
 endif
 
+have_bpf_skel_deps := $(shell printf '#include <libelf.h>\n#include <zlib.h>\n#include <linux/bpf.h>\n#include <openssl/opensslv.h>\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


  parent reply	other threads:[~2026-10-13 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 22:16 [PATCH v1 0/2] perf build: Support building BPF skeletons with bpf-gcc Ian Rogers
2026-10-13 22:16 ` [PATCH v1 1/2] " Ian Rogers
2026-10-13 22:16 ` Ian Rogers [this message]
2026-10-13 23:14 ` [PATCH v2 0/2] " Ian Rogers
2026-10-13 23:14   ` [PATCH v2 1/2] " Ian Rogers
2026-10-13 23:14   ` [PATCH v2 2/2] perf test make: Add BPF skeleton build tests for clang and bpf-gcc Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261013221643.1815686-3-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=david.faust@oracle.com \
    --cc=eddyz87@gmail.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=jose.marchesi@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®