From nobody Sat Oct 24 13:20:48 2026 Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C0F9563FB2 for ; Tue, 13 Oct 2026 23:14:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.199 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791933283; cv=none; b=Qhz/cQlm9u/zPv2svYh/YvnjUyPKZrJXvd57Hg92npXD9vGBE+aHXbN6UYhdAdTmK/109lFxQpi22ZuqxenTDwSLg3kqeQK8Z968M0QNadratb2WtzFs+tknbTLlEuQS5Cs1lSJeznImljOg2bnTgGMLYjHP4HuZn19LG0YIm4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791933283; c=relaxed/simple; bh=blhkNd7YPOHByM6jhZraZMpx6Hjvkwqjwud40X2q32M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=u04jAM6YhchYeVB3FH43Oif8fhnRrp5tThE770BXmXlUD6puk9GoHRTSVHgda1vlbGvK6j4pFHy20kUqWlRhp+Z6teSrUeAOa4imFIGfAq8+39x5EP1lSvQ+IypNooeAuP8RcjuBgcGC7gG77yLXQGHzzmPl5qthdGyVV4RU38Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TrdzdBIm; arc=none smtp.client-ip=74.125.82.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TrdzdBIm" Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-341eff9e381so9500913eec.1 for ; Tue, 13 Oct 2026 16:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1791933281; x=1792538081; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=qYhrg7g0yJ8cu7vKkFE0QJOFgou8b+/PjQRDx5Q9dOk=; b=TrdzdBImLWxvuoJqlWZSFjhpuMu0XJlaGKTpVFT6k2B/dAjWbh/+WeJW+mhQ4EFbUV A/nFv4SryXT8OxfSe1KBLtx26uJFtVC54N1J2txY3O3JducxJhDKexz348ObfgJPQ8nP bOhyIjEZSHbqW/q/OITDzXvmHd3CaDu0GUfTdPT4UUKCjHSHttpDYm5AVI2kdNaqPB6O oSBPj9LdyG451Ueb6FWILNDo4dKQeFy49mwpJz2z2lOzoKNjuKtk0h8Hsad1eDXm+QQv uyghvYjm/iXMYvkeWCQsS5tytMlYecEj6MlF7ykAbUF9PXr+2MXPyDHMJ4whWabE1VNp UV/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791933281; x=1792538081; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qYhrg7g0yJ8cu7vKkFE0QJOFgou8b+/PjQRDx5Q9dOk=; b=R84dm5wgsCnDLrbNde91qat+E07JL/SJC0e4TsQvh24fqTbcExbDShYuYhwpuRg7sD hMMhTZez3kHNZvapqC0LvI7bLTdq9XCZMUAmofuUb/J7ijpqqeoftaUely/ISGFn4yrX Hwvy0fKosc/7PiobNy96tJ9RP4KHGqo6XesJH2eFhevfwYyGkQ98RJPI8w8zqUxzou+w l5SXMSnAuJueHwVnS2j9RboQ7lpBkAAWR0lL7c0N1fA189J5qOGaIRep6bSolY+0WvLw FAClySpvGDEgU0SEQO8sJpYSHk1PDqP/rewHgKHcta11WKW1LVqdNBE331S5vcWeoNQl kNNg== X-Forwarded-Encrypted: i=1; AKwUvByBAegKPkLPyUl6F/SgCCxHYABJgPvI5GJrBnF5GevSneq0e2iGmAh3st3S1vxZ9g871yK2uGMkOErkf5I=@vger.kernel.org X-Gm-Message-State: AFq9FYKjmn/ir4Es0S+tI3ktzxzDVyPN2Oo/ok6qcRBrvsVz0MSpISo6 yjGGjivlRAun2nAwe42IqholtYQIGK1Sk4J7UGqZPTofJvemBmnrX3fSp9bd42cnchW1BWnS77q uMFE6RzBH8w== X-Received: from dyx5.prod.google.com ([2002:a05:693c:8205:b0:35c:bd2a:aeb]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:693c:8103:b0:34a:fc46:35ba with SMTP id 5a478bee46e88-3537dfc6e87mr22274259eec.8.1791933280166; Tue, 13 Oct 2026 16:14:40 -0700 (PDT) Date: Tue, 13 Oct 2026 16:14:29 -0700 In-Reply-To: <20261013231430.2163505-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20261013221643.1815686-1-irogers@google.com> <20261013231430.2163505-1-irogers@google.com> X-Mailer: git-send-email 2.56.0.385.gd3acb90ef8-goog Message-ID: <20261013231430.2163505-2-irogers@google.com> Subject: [PATCH v2 1/2] perf build: Support building BPF skeletons with bpf-gcc From: Ian Rogers To: irogers@google.com, acme@kernel.org, cupertino.miranda@oracle.com, jose.marchesi@oracle.com, namhyung@kernel.org Cc: adrian.hunter@intel.com, andrii@kernel.org, eddyz87@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, yonghong.song@linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Support building perf BPF skeletons with bpf-gcc (>=3D 14.0.0) in addition to clang (>=3D 12.0.1), similar to tools/testing/selftests/bpf/Makefile. When building perf with GCC (CC_NO_CLANG=3D1), prefer bpf-gcc and fall back to clang if bpf-gcc is unavailable or too old. When building with Clang/LLVM (CC_NO_CLANG=3D0), prefer clang and fall back to bpf-gcc. Explicit command-line overrides via BPF_GCC=3D... or CLANG=3D... are respected, and setting BPF_GCC=3D or CLANG=3D to empty disables that compiler. In bpf_skel.mak, pass the bpf-gcc flags (-mcpu=3Dv3, -fno-ident, -DBPF_NO_PRESERVE_ACCESS_INDEX, -Wno-attributes, -D__TARGET_ARCH_$(SRCARCH), and target endianness) and query system include paths from $(CC). Also update version-ge3 and version-lt3 in tools/scripts/utilities.mak to split the two version arguments separately in awk so empty or fewer-than-3-component version strings do not shift fields across arguments. Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 83 +++++++++++++++++++++++++++------- tools/perf/Makefile.perf | 8 +++- tools/perf/bpf_skel.mak | 36 ++++++++++----- tools/scripts/Makefile.include | 1 + tools/scripts/utilities.mak | 4 +- 5 files changed, 101 insertions(+), 31 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index cafc7be79643..235872e65d8f 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -662,27 +662,78 @@ ifeq ($(BUILD_BPF_SKEL),1) else ifeq ($(filter -DHAVE_LIBOPENSSL_SUPPORT, $(CFLAGS)),) $(warning Warning: Disabled BPF skeletons as libopenssl is required) BUILD_BPF_SKEL :=3D 0 - else ifeq ($(call get-executable,$(CLANG)),) - $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missi= ng) - BUILD_BPF_SKEL :=3D 0 - else - CLANG_VERSION :=3D $(shell $(CLANG) --version | head -1 | sed 's/.*cla= ng version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g') - ifeq ($(call version-lt3,$(CLANG_VERSION),12.0.1),1) - $(warning Warning: Disabled BPF skeletons as reliable BTF generation= needs at least $(CLANG) version 12.0.1) - BUILD_BPF_SKEL :=3D 0 - endif endif ifeq ($(BUILD_BPF_SKEL),1) - $(call feature_check,clang-bpf-co-re) - ifeq ($(feature-clang-bpf-co-re), 0) - $(warning Warning: Disabled BPF skeletons as clang is too old) + # Prefer bpf-gcc when building with gcc (CC_NO_CLANG=3D1) and clang wh= en + # building with clang, unless CLANG or BPF_GCC was explicitly specifie= d on + # the command line. Fall back to whichever compiler is available. + prefer_bpf_gcc :=3D $(CC_NO_CLANG) + ifeq ($(origin BPF_GCC),command line) + ifneq ($(BPF_GCC),) + prefer_bpf_gcc :=3D 1 + endif + else ifeq ($(origin CLANG),command line) + ifneq ($(CLANG),) + prefer_bpf_gcc :=3D 0 + endif + endif + + have_bpf_gcc :=3D 0 + have_clang_bpf :=3D 0 + + define check_bpf_gcc + ifneq ($$(call get-executable,$$(BPF_GCC)),) + BPF_GCC_VERSION :=3D $$(shell $$(BPF_GCC) -dumpfullversion 2>/dev/= null) + ifneq ($$(BPF_GCC_VERSION),) + ifneq ($$(call version-lt3,$$(BPF_GCC_VERSION),14.0.0),1) + have_bpf_gcc :=3D 1 + endif + endif + endif + endef + + ifeq ($(prefer_bpf_gcc),1) + $(eval $(check_bpf_gcc)) + endif + + ifeq ($(have_bpf_gcc),0) + ifneq ($(call get-executable,$(CLANG)),) + CLANG_VERSION :=3D $(shell $(CLANG) --version | head -1 | sed 's/.= *clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g') + ifneq ($(call version-lt3,$(CLANG_VERSION),12.0.1),1) + $(call feature_check,clang-bpf-co-re) + ifeq ($(feature-clang-bpf-co-re), 1) + have_clang_bpf :=3D 1 + endif + endif + endif + endif + + ifeq ($(prefer_bpf_gcc)$(have_clang_bpf),00) + $(eval $(check_bpf_gcc)) + endif + + ifeq ($(have_bpf_gcc),1) + $(call detected,CONFIG_PERF_BPF_SKEL_BPF_GCC) + $(call detected,CONFIG_PERF_BPF_SKEL) + CFLAGS +=3D -DHAVE_BPF_SKEL + else ifeq ($(have_clang_bpf),1) + $(call detected,CONFIG_PERF_BPF_SKEL) + CFLAGS +=3D -DHAVE_BPF_SKEL + else + ifeq ($(call get-executable,$(CLANG))$(call get-executable,$(BPF_GCC= )),) + $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) and = bpf-gcc ($(BPF_GCC)) are missing) + else ifneq ($(call get-executable,$(CLANG)),) + ifeq ($(call version-lt3,$(CLANG_VERSION),12.0.1),1) + $(warning Warning: Disabled BPF skeletons as reliable BTF genera= tion needs at least $(CLANG) version 12.0.1) + else + $(warning Warning: Disabled BPF skeletons as clang is too old) + endif + else + $(warning Warning: Disabled BPF skeletons as bpf-gcc ($(BPF_GCC)) = needs at least version 14.0.0) + endif BUILD_BPF_SKEL :=3D 0 endif endif - ifeq ($(BUILD_BPF_SKEL),1) - $(call detected,CONFIG_PERF_BPF_SKEL) - CFLAGS +=3D -DHAVE_BPF_SKEL - endif endif =20 ifndef GEN_VMLINUX_H diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 2d9379fea267..4061a79cae54 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -37,6 +37,9 @@ include ../scripts/utilities.mak # Define EXTRA_BPF_FLAGS=3D"--sysroot=3D" or other custom include pa= ths for # cross-compiling BPF skeletons # +# Define BPF_GCC to point to the bpf-gcc binary if the default `bpf-gcc' i= s not +# correct, or set BPF_GCC=3D to disable using bpf-gcc for BPF skeletons. +# # Define EXCLUDE_EXTLIBS=3D-lmylib to exclude libmylib from the auto-gener= ated # EXTLIBS. # @@ -208,6 +211,7 @@ FIND =3D find INSTALL =3D install FLEX ?=3D flex BISON ?=3D bison +BPF_GCC ?=3D bpf-gcc AWK =3D awk =20 # include Makefile.config by default and rule out @@ -321,8 +325,8 @@ ifneq ($(force_fixdep),1) endif endif =20 -export srctree OUTPUT RM CC CXX RUSTC CLANG LD AR CFLAGS CXXFLAGS RUST_FLA= GS V BISON FLEX AWK LIBBPF READELF -export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK MYPY PYLINT CONFIG_PERF_= BPF_SKEL +export srctree OUTPUT RM CC CXX RUSTC CLANG BPF_GCC LD AR CFLAGS CXXFLAGS = RUST_FLAGS V BISON FLEX AWK LIBBPF READELF +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK MYPY PYLINT CONFIG_PERF_= BPF_SKEL CONFIG_PERF_BPF_SKEL_BPF_GCC =20 include $(srctree)/tools/build/Makefile.include =20 diff --git a/tools/perf/bpf_skel.mak b/tools/perf/bpf_skel.mak index f2559de39f96..7b7edf506509 100644 --- a/tools/perf/bpf_skel.mak +++ b/tools/perf/bpf_skel.mak @@ -22,21 +22,35 @@ bpf-skel-prepare: $(BPFTOOL) $(VMLINUX_H) define get_sys_includes $(shell $(1) $(2) -v -E - &1 \ | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/= .*\)|-idirafter \1|p }') \ -$(shell $(1) $(2) -dM -E - =3D (10000000 * $$4 + 10000 * $$5 + $$6)= ) }') +version-ge3 =3D $(shell awk -v v1=3D"$(1)" -v v2=3D"$(2)" 'BEGIN { split(v= 1, a, "."); split(v2, b, "."); printf("%d\n", (10000000 * a[1] + 10000 * a[= 2] + a[3]) >=3D (10000000 * b[1] + 10000 * b[2] + b[3])) }') =20 # version-lt3 # @@ -196,4 +196,4 @@ version-ge3 =3D $(shell echo "$(1).$(2)" | awk -F'.' '{= printf("%d\n", (10000000 * # check the flex version to see if we can use compiler warnings as errors = for # one of the cases flex generates code C compilers complains about. =20 -version-lt3 =3D $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10= 000000 * $$1 + 10000 * $$2 + $$3) < (10000000 * $$4 + 10000 * $$5 + $$6)) }= ') +version-lt3 =3D $(shell awk -v v1=3D"$(1)" -v v2=3D"$(2)" 'BEGIN { split(v= 1, a, "."); split(v2, b, "."); printf("%d\n", (10000000 * a[1] + 10000 * a[= 2] + a[3]) < (10000000 * b[1] + 10000 * b[2] + b[3])) }') --=20 2.56.0.385.gd3acb90ef8-goog From nobody Sat Oct 24 13:20:48 2026 Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFFB45650E2 for ; Tue, 13 Oct 2026 23:14:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.199 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791933285; cv=none; b=dzewkXlrCRq+nn90q4OuWLA4ec8iHaMM0ZyuiE16YiHZJGrUf5yAvtnBJaQDeVBIW2dXlFOJ7V4QzqLzoxMU3mLy84KCNedQ/d884VQv+W+PLZzOg/U6wByBbJyzAK/fGUDuiQw+HpL8r2gLefxH8BaN/sEITqAk0lecSF2rvVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791933285; c=relaxed/simple; bh=4A/ANomF4iGWg9aVggtR1rNe+S7/Bw8fq2TxzSqyx/E=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ZnSVY+daug7DlFfXxdkNPs1rCIJLbrJ2P7daP61XBcpcUnp/tbE24VyCdtF06UohztD0zAqsUxBX799IXdI0e6Lm8tQUR7z9ZDDNEhcbTsyCXr12Cw4UjO35zumKh2xV8NnLzkxceyABDsaux/OVVV1/Kl/eXbt+jRZyXp+aXu8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TMpEnGmp; arc=none smtp.client-ip=74.125.82.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TMpEnGmp" Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-341eff9e381so9501033eec.1 for ; Tue, 13 Oct 2026 16:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1791933283; x=1792538083; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hA27tTR2dWgZDMscmH9VhLIFtST18vRloUltjoMKrNs=; b=TMpEnGmppY9Ty7J1uYlvEH8aumSgjeJXFbf52cE/bdASWUQUwuoQlN1a1KcPoz2khR Y4EdkvqBZw8eSoeLP/i2BCGC2VU7DDLQN6FcPVl5/aT73Q9DM/IORMQUN+6q+O6hl7xP /b+EqTzNP2m5e7v0pSb0mC9suh6Fmq26oKPmtiX+KFvimhwV1Hl2wp8xAXesdQW5NN2H LAWKwdiAYf204JqE1ID3KamssypIGKUE/oYBk2f0G4nS7V8IzFiJY/jyDIJzpCgaj2RS 45574oNjVq/lzwgMrWqlkzXcYCKYJN0UfZ+h9bAtv9wn8zrSXOwlzlKS37TNQFKOztCR 0kLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791933283; x=1792538083; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hA27tTR2dWgZDMscmH9VhLIFtST18vRloUltjoMKrNs=; b=LeCNb2br1qKm0D5d+ikwrEiEAT8uKFrmvMUgl1zZBX+7sWem18Poy7ss1lpfK5ghjp 8H4SsmQ4fjo3Z/pe8euFgr3AMSaBlNwBrjUJuWwWNxXfhpACfdqfZItGN1eOhSpMlCTQ 7skcPAEBpHdTvjTrr5oh76qQFUwig5K1+2DyPJJl54P9/Oj1oey0kRPgSS2hSP5JgcXh ZQERsJ4w+YKp/MxDLVD9xvtk+udPL+hWSFdtA0xQwrVnHL2HcwN2jX+Ip9O53+L87Ubx JFMqbFlL2LFPHFyViuB/k93c61DgntXdPrT54Rp4VIp/5GoP+uRNrz3gQLUOlnIHXgBR u2iQ== X-Forwarded-Encrypted: i=1; AKwUvBxS3llrPFhaBdZbc/PBxpFhkpV+EkTj9OzEsS/nnUf/acmObD2WKl/+uJSNczL9SK/nTHFPkk3Qz1nmhKw=@vger.kernel.org X-Gm-Message-State: AFq9FYKg6xUs6FhnixUMox0eB/G+p0r8+TkUGKj/sQ/4nJ41b0sGRXuY OmgDPrvKxTCE57r1bZ0zFc25fWdwSqRFKT4iNoUgB0BmTDi4Urbq5BsvCL68ft42YDkb7XbvLEZ MLlxdngDzyg== X-Received: from dlbts25-n2.prod.google.com ([2002:a05:7022:b059:20b0:168:46d:d4f5]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:701b:454b:20b0:144:f096:4dda with SMTP id a92af1059eb24-16a6203de6dmr18429574c88.43.1791933282544; Tue, 13 Oct 2026 16:14:42 -0700 (PDT) Date: Tue, 13 Oct 2026 16:14:30 -0700 In-Reply-To: <20261013231430.2163505-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20261013221643.1815686-1-irogers@google.com> <20261013231430.2163505-1-irogers@google.com> X-Mailer: git-send-email 2.56.0.385.gd3acb90ef8-goog Message-ID: <20261013231430.2163505-3-irogers@google.com> Subject: [PATCH v2 2/2] perf test make: Add BPF skeleton build tests for clang and bpf-gcc From: Ian Rogers To: irogers@google.com, acme@kernel.org, cupertino.miranda@oracle.com, jose.marchesi@oracle.com, namhyung@kernel.org Cc: adrian.hunter@intel.com, andrii@kernel.org, eddyz87@gmail.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, yonghong.song@linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add make_bpf_skel_clang (CLANG=3Dclang BPF_GCC=3D) and make_bpf_skel_bpf_gcc (BPF_GCC=3Dbpf-gcc CLANG=3D) 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 :=3D EXTRA_TESTS=3D1 make_no_jevents :=3D NO_JEVENTS=3D1 make_jevents_all :=3D JEVENTS_ARCH=3Dall make_no_bpf_skel :=3D BUILD_BPF_SKEL=3D0 +make_bpf_skel_clang :=3D CLANG=3Dclang BPF_GCC=3D +make_bpf_skel_bpf_gcc :=3D BPF_GCC=3Dbpf-gcc CLANG=3D make_gen_vmlinux_h :=3D GEN_VMLINUX_H=3D1 make_no_python_module :=3D NO_PYTHON_MODULE=3D1 make_no_scripts :=3D NO_PYTHON_MODULE=3D1 @@ -142,6 +144,20 @@ have_libllvm :=3D $(shell printf '#include \n#includ $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null) >/dev/null 2>&1 && ech= o y) endif =20 +have_bpf_skel_deps :=3D $(shell printf '#include \n#include \n#include \n#include \nint main(){ret= urn 0;}\n' | \ + $(CC) -x c -I$(srctree)/tools/include/uapi - -o /dev/null -lelf -lz -lcry= pto >/dev/null 2>&1 && echo y) + +ifneq ($(have_bpf_skel_deps),) +ifneq ($(call has,clang),) +have_clang_bpf :=3D $(shell printf '#if (__clang_major__ < 12) || (__clang= _major__ =3D=3D 12 && __clang_minor__ =3D=3D 0 && __clang_patchlevel__ < 1)= \n#error "old"\n#endif\n' | \ + clang -S -g --target=3Dbpf -x c - -o /dev/null >/dev/null 2>&1 && echo y) +endif +ifneq ($(call has,bpf-gcc),) +have_bpf_gcc :=3D $(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 :=3D make_pure # Targets 'clean all' can be run together only through top level @@ -173,6 +189,12 @@ run +=3D make_extra_tests run +=3D make_no_jevents run +=3D make_jevents_all run +=3D make_no_bpf_skel +ifneq ($(have_clang_bpf),) +run +=3D make_bpf_skel_clang +endif +ifneq ($(have_bpf_gcc),) +run +=3D make_bpf_skel_bpf_gcc +endif run +=3D make_gen_vmlinux_h run +=3D make_no_python_module run +=3D make_no_scripts @@ -313,6 +335,13 @@ test_make_clang_nondistro :=3D $(test_make_clang) test_make_clang_nondistro_O :=3D $(test_make_clang_O) endif =20 +test_make_no_bpf_skel :=3D test -x $(PERF_O)/perf && ! $(PERF_O)/p= erf check -q feature bpf_skeletons +test_make_no_bpf_skel_O :=3D test -x $$TMP_O/perf && ! $$TMP_O/perf = check -q feature bpf_skeletons +test_make_bpf_skel_clang :=3D test -x $(PERF_O)/perf && $(PERF_O)/per= f check -q feature bpf_skeletons +test_make_bpf_skel_clang_O :=3D test -x $$TMP_O/perf && $$TMP_O/perf ch= eck -q feature bpf_skeletons +test_make_bpf_skel_bpf_gcc :=3D test -x $(PERF_O)/perf && $(PERF_O)/per= f check -q feature bpf_skeletons +test_make_bpf_skel_bpf_gcc_O :=3D test -x $$TMP_O/perf && $$TMP_O/perf ch= eck -q feature bpf_skeletons + test_make_python_perf_so_O :=3D test -f $$TMP_O/python/perf.so test_make_perf_o_O :=3D test -f $$TMP_O/perf.o test_make_util_map_o_O :=3D test -f $$TMP_O/util/map.o --=20 2.56.0.385.gd3acb90ef8-goog