From nobody Thu Apr 9 05:06:25 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7C5C3BADA6; Wed, 11 Mar 2026 08:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773217841; cv=none; b=arbjPaCXVQW9+3926bMHjwTrGZjHLUjd/G3aXw/b7QMm/QSDEEhIPAHAHdhtPdzEsHrFuC/4pARrsoF9a3LhGZiOJ9M4lPfmPCaBkhJFu6Gg56MY8vbL/11FFokqU8v51Pt4Sy8JlVNt0QK5i5jjwMCcsXFuSXXKd41bTXc5mqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773217841; c=relaxed/simple; bh=WM6eh+uCyejH6wIt9/C1ZZ9YLOLPrcxUmJlFRRJ40zM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u5noK+3pX31glcDCkSJNXT2DuAGv5ZMgZpMMFbBQHltixc0y/WBeUJJ2+IY8qNEbryXXPA7o4PntvsIBoF79l59wA1fjnmbGwqy3ErrbIHi8WWRxo34oAw5dH414e/reYg0OU9SBeGy4IHdwAC54tE3dTIrcb7HiFcXTpSpsn9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F139D2050; Wed, 11 Mar 2026 01:30:29 -0700 (PDT) Received: from e132581.arm.com (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B1DB33F73B; Wed, 11 Mar 2026 01:30:28 -0700 (PDT) From: Leo Yan Date: Wed, 11 Mar 2026 08:29:30 +0000 Subject: [PATCH v4 05/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260311-tools_build_fix_zero_init-v4-5-9e35bdb99cb3@arm.com> References: <20260311-tools_build_fix_zero_init-v4-0-9e35bdb99cb3@arm.com> In-Reply-To: <20260311-tools_build_fix_zero_init-v4-0-9e35bdb99cb3@arm.com> To: Arnaldo Carvalho de Melo , Ian Rogers , Namhyung Kim , James Clark , Kees Cook , Quentin Monnet , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Adrian Hunter , Masami Hiramatsu , William Breathitt Gray , Barry Song , Qinxin Xia , Bartosz Golaszewski , Kent Gibson , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Andrew Morton , Willy Tarreau , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Josh Poimboeuf , Robert Moore , Len Brown , Srinivas Pandruvada , Tejun Heo , David Vernet , Andrea Righi , Changwoo Min , Mark Brown , Steven Rostedt , Gabriele Monaco , Shuah Khan , Jiri Kosina , Benjamin Tissoires Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773217789; l=1436; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=WM6eh+uCyejH6wIt9/C1ZZ9YLOLPrcxUmJlFRRJ40zM=; b=AX5ygT7o789kWjNCr+Hi0sW7qCH4wNnmL5QDZ0Yc3lbK4gd64g8HZbJl9gVupvu2p0xA2UtXS LOU0a3HayNNCatI4O8VFT2uixNICvIfcAAguFQ5pRzrfiCUEvlm+Gm0 X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= Prepare for future changes where EXTRA_CFLAGS may include flags not applicable to the host compiler. Move the HOST_CFLAGS assignment before appending EXTRA_CFLAGS to CFLAGS so that HOST_CFLAGS does not inherit flags from EXTRA_CFLAGS. Acked-by: Quentin Monnet Signed-off-by: Leo Yan --- tools/bpf/bpftool/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile index 519ea5cb8ab1c0ee31acc67fc5f96b40e21005c2..3e7d8359e1b2a81a29a47544be8= 539e3b191a0e8 100644 --- a/tools/bpf/bpftool/Makefile +++ b/tools/bpf/bpftool/Makefile @@ -81,6 +81,12 @@ CFLAGS +=3D -DPACKAGE=3D'"bpftool"' -D__EXPORTED_HEADERS= __ \ ifneq ($(BPFTOOL_VERSION),) CFLAGS +=3D -DBPFTOOL_VERSION=3D'"$(BPFTOOL_VERSION)"' endif + +# This must be done before appending EXTRA_CFLAGS to CFLAGS to avoid +# including flags that are not applicable to the host compiler. +HOST_CFLAGS :=3D $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE)= ,\ + $(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS))) + ifneq ($(EXTRA_CFLAGS),) CFLAGS +=3D $(EXTRA_CFLAGS) endif @@ -88,8 +94,6 @@ ifneq ($(EXTRA_LDFLAGS),) LDFLAGS +=3D $(EXTRA_LDFLAGS) endif =20 -HOST_CFLAGS :=3D $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE)= ,\ - $(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS))) HOST_LDFLAGS :=3D $(LDFLAGS) =20 INSTALL ?=3D install --=20 2.34.1