From nobody Sun Feb 8 15:57:31 2026 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (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 26C852D2496 for ; Tue, 23 Dec 2025 08:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766479444; cv=none; b=h2t2pwSgfDSjX6bEPDTRWoa2LhKYRBcepWUfJdiCxHWdLc2SbE02VxS8KKNiDDox6dnSq8nCqbWvN0Zgxwld+E3rVuGrdWJpSLOf3l/cUUjT/uQteKezxL/O8dQtjONUpcv03AMwXbnAzxnVBnQwFsPdW8U9GCraikB/+PiUVdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766479444; c=relaxed/simple; bh=JNcxDi8XtzEu3xbpObOr3vCN2IHmRD7IAR2ObU+ycjA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r9bu7uMENdSm83mDtqjk7bTbJmQSguxrvfLPITB4ufQa4xm70MZ3iAUjfrcJ1/RjiHQQoAI66ZvA2b3+g7BhuoAhr5vXZ/vyQslMVjWqq0p0aqAPbJpV7vZsoq2i6LhEBrBQ3fL/xKJMDYkp/3us7hkdnOQfLR4VdmE+5bxJl48= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kX3YAH7I; arc=none smtp.client-ip=209.85.215.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kX3YAH7I" Received: by mail-pg1-f193.google.com with SMTP id 41be03b00d2f7-c03ec27c42eso2729559a12.1 for ; Tue, 23 Dec 2025 00:44:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766479442; x=1767084242; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=oNT47R5lyHr6s83aFhP7qeMV+Nwtti6xzxLjC7+hnjk=; b=kX3YAH7ITnk4k8ju8X+TWFVqTsEzrnfcrALl1eA145Rurcfg330eqNSTrxN+EzsUof 3EF6kKH5Jn4xDLfzrEY76wheOaVgR7lfq/IsKaD0rCqDdOvoXMjE1182ypqf5j4YFzvL okPnncOmCJzlUUw3rHHSnhtP/kb1M6nzDoAKvYJESCrLARfjE/St0/yPSezUfytcA6HV F2+yByzdh/83fAObVUBWzE5dITDnbMF4Cv8tCak9LKQAgKTq4Yekkt8+Nx94YWEKNhdo pFVTNbcETqLAXMSX51vt2qMQBnuFYgtZMS1RYXyK9xwNgaik2Qqc8M1BwFcivtfj2zGB zM5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766479442; x=1767084242; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=oNT47R5lyHr6s83aFhP7qeMV+Nwtti6xzxLjC7+hnjk=; b=LXB/ny2S/5nTEPgFA+rSnIO0H5ZNfuchuInVh7usa3wa0bfQ3jbbcUu+tAL6642NL+ S62wy+AVr0qMoQKoi82IF16Spkkn/M//5T4MxEp5FRH9uGGbP7R57XvP1s0EzEXIbgmQ vnjq8KX+SPFCxFfHihJu0yKUlhABpT/S1LSFd9zahOJgtpGEEJ7GdajBRcg4rAck7Si7 lT7vozXdJLx9vblxVEaCdedqblLenAPn0nxfxR19/oLJ2ROTwJ5SQJCfHnVhppXxM4yy DnZVW4X8DdnO/laOepLG98f6WjNq8fWqqqAcKc4s2j9O5BND8L3xsxYhDGTo/DwMgnbl 0rvQ== X-Forwarded-Encrypted: i=1; AJvYcCU0oPJpCxpKu4gLPR2FAb6wmh5rbtS6x7eIlfWFWs7kydDInu36vk7oR8zclFYPlQPGJ2s+zhLHTRu1W4Q=@vger.kernel.org X-Gm-Message-State: AOJu0YybRc3pPDTE/zs0wmsGWRdVpEhU0FfASixSiLj5L+qHjF26pF8r JV8VAwjXMwsBHJMbKv9X0ln6+p5W+M6aUi65Ae2NQyE6xnSu+Nw6EN7F X-Gm-Gg: AY/fxX7rlxhYW8WA8JC1knZMWBo6Rp/ZIpu1vRhGKEJ7QMiB8aX5xx1MXJIP8ARCB6R DAhA4K+4IJLAv/RoHpy7/JHIfeLzy1fyOLzV1548kUP9IXLJKTbwzBQrBVBKKr2GsJScJNIZZ0l HF4nJ0WYfNSrgRugZ1akQZ9Yp8pLB6uWTuPl2LYseRjkShBskRpJ62vmIyeknHQCTe3sVuCM5Uh zSuILVhDH9jjyP0Dfg5+OYfhasmrI0pt2Gm88EdcfyRat62kfiVF4i6jpQXzWGdgMoiEgJIbE/R GREBmxdEh21r/4g6dNy/XObeSbsaITv8aQxtSzQv+ozDNJjJvCCG9WEJIS0K8goky/hl1VzSp23 t2MPMg2p73EefWxUdtOpgxj3/a+PEEa/+BqBmgx04WLHYxIRgE0wOKwDJfgIJSvm00OD09Wc0cK QUxYAWUtz2vOvtukFgAx8QtgZrOA== X-Google-Smtp-Source: AGHT+IHYU+Os1x0yRwca4Pe17iWLQntYr4tzo/e2hIsHQnCg2+Cy7uhXYlQBCpFNDm7a2HU6WuZDfQ== X-Received: by 2002:a05:7300:50e2:b0:2ae:5b2e:9d45 with SMTP id 5a478bee46e88-2b05ecb39c4mr10097700eec.38.1766479442294; Tue, 23 Dec 2025 00:44:02 -0800 (PST) Received: from HUC.. ([149.34.251.245]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1217254c734sm56720887c88.13.2025.12.23.00.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Dec 2025 00:44:01 -0800 (PST) From: hupu To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, james.clark@linaro.org, nathan@kernel.org, nick.desaulniers+lkml@gmail.com, morbo@google.com, justinstitt@google.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, hupu.gm@gmail.com Subject: [RFC 1/2] perf build: Allow passing extra Clang flags via EXTRA_BPF_FLAGS Date: Tue, 23 Dec 2025 16:43:34 +0800 Message-ID: <20251223084337.3789-2-hupu.gm@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251223084337.3789-1-hupu.gm@gmail.com> References: <20251223084337.3789-1-hupu.gm@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for EXTRA_BPF_FLAGS in the eBPF skeleton build, allowing users to pass additional Clang options such as --sysroot or custom include paths when cross-compiling perf. This is primarily intended for cross-build scenarios where the default host include paths do not match the target kernel version. Example usage: make perf ARCH=3D"arm64" EXTRA_BPF_FLAGS=3D"--sysroot=3D..." Change history: v5: - Update commit message v4: - Apply EXTRA_BPF_FLAGS directly to BPF skeleton build command instead of modifying CLANG_OPTIONS v3: - Move the variable description comment to the top of Makefile.perf - Update commit message v2: - Rename EXTRA_CLANG_FLAGS to EXTRA_BPF_FLAGS - Update commit message v1: - Introduce EXTRA_CLANG_FLAGS to allow passing extra Clang options Signed-off-by: hupu Reviewed-by: Namhyung Kim --- tools/perf/Makefile.perf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index b3f481a626af..8b8647fd4f41 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -35,6 +35,9 @@ include ../scripts/utilities.mak # # Define EXTRA_CFLAGS=3D-m64 or EXTRA_CFLAGS=3D-m32 as appropriate for cro= ss-builds. # +# Define EXTRA_BPF_FLAGS=3D"--sysroot=3D" or other custom include pa= ths for +# cross-compiling BPF skeletons +# # Define EXCLUDE_EXTLIBS=3D-lmylib to exclude libmylib from the auto-gener= ated # EXTLIBS. # @@ -1250,7 +1253,7 @@ endif $(SKEL_TMP_OUT)/%.bpf.o: $(OUTPUT)PERF-VERSION-FILE util/bpf_skel/perf_ver= sion.h | $(SKEL_TMP_OUT) $(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlin= ux.h $(QUIET_CLANG)$(CLANG) -g -O2 -fno-stack-protector --target=3Dbpf \ - $(CLANG_OPTIONS) $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ + $(CLANG_OPTIONS) $(EXTRA_BPF_FLAGS) $(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 $@ =20 --=20 2.43.0