From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27FA136167E; Fri, 13 Mar 2026 15:56:02 +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=1773417364; cv=none; b=TzzqrMNXI0ofnCueq177hAYAieC04qRtRYYb9Lr1MGfyEx+HzdX4S87xcFM8SEBpcrbayiirUY/eqaB319IevTn9tRfEI86OH1cELHDsGN46lUsx8NJgQnjaWEnqTIvc+Dq2o/dA7L7T1+rmGBlj94au5GLsNpRvfZIgLOTq6Wk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773417364; c=relaxed/simple; bh=6ooeKtjYil+mRAJH+ITgn5AMUBCanAMgyseJSfl/7Vk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oQ8Bm8VssnNaPLeG7xFDYsJqIGfwvOJ5sW+bj/AbDvF/+B/0CxMKwq4Q99MVMe0DjSG1Sw3zNrSVBwKIzVpc8QBn/9WQ+gHepmlBaTR9suEEovdgPoTuCMIev8KZlmZpW6/1+YpWT+B5I+51t512U6XDBnlgNwqQ1nLFxSOMvME= 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 3D61D176A; Fri, 13 Mar 2026 08:55:56 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 19FD93F73B; Fri, 13 Mar 2026 08:56:02 -0700 (PDT) Date: Fri, 13 Mar 2026 15:56:00 +0000 From: Leo Yan To: Ian Rogers Cc: Arnaldo Carvalho de Melo , 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 , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Andrew Morton , Willy Tarreau , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , 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 , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH v4 05/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Message-ID: <20260313155600.GP4153946@e132581.arm.com> References: <20260311-tools_build_fix_zero_init-v4-0-9e35bdb99cb3@arm.com> <20260311-tools_build_fix_zero_init-v4-5-9e35bdb99cb3@arm.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Mar 12, 2026 at 10:19:01AM -0700, Ian Rogers wrote: > On Wed, Mar 11, 2026 at 1:30 AM Leo Yan wrote: > > > > 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..3e7d8359e1b2a81a29a47544be8539e3b191a0e8 100644 > > --- a/tools/bpf/bpftool/Makefile > > +++ b/tools/bpf/bpftool/Makefile > > @@ -81,6 +81,12 @@ CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \ > > ifneq ($(BPFTOOL_VERSION),) > > CFLAGS += -DBPFTOOL_VERSION='"$(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 := $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE),\ > > + $(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS))) > > + > > ifneq ($(EXTRA_CFLAGS),) > > CFLAGS += $(EXTRA_CFLAGS) > > endif > > @@ -88,8 +94,6 @@ ifneq ($(EXTRA_LDFLAGS),) > > LDFLAGS += $(EXTRA_LDFLAGS) > > endif > > > > -HOST_CFLAGS := $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE),\ > > - $(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS))) > > HOST_LDFLAGS := $(LDFLAGS) > > Should HOST_LDFLAGS be similarly moved? Otherwise, it seems target > flags in EXTRA_LDFLAGS will be added for the host. Though this series is irrelevant to LDFLAGS, I am fine to move HOST_LDFLAGS together. Quentin, how about you think?