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 D4E3B38B7CD; Mon, 9 Mar 2026 10:07:11 +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=1773050835; cv=none; b=h/HtTi6EP+QLJPMiX2Rrvqj14TPNgnfGWN0suYU30vRvw2qUhGsLLmxWeUo4N+wXtGtTDdiBlIatrakIr6eUjXEyVGCiL83wYJ0uDD0GRFsVVXFmzkBmWpKmN7AC+kS9zE4lO0jJeV81DiSVuBRfx378yEmLp5W97UmyNVfwfsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773050835; c=relaxed/simple; bh=niigQqdnyEgr+xuuEMIVsG1eGQfD+BEJm+xOSQaVtLo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X8GbcA/zbkn5c3C9qGq8hGsNu0xI484w3FSP9tV3BJrDyUyJVnojfNEmyq7/H+a0ONXLaax0LmFuucTAwWtqDc+Cv2Wl86Fyk6+bUtxoHWsOV1TD4bnS8CTR+5wYDLy3iT1W934kTkHTPttU9IPmK8F2C79PR+sieyinUBGdxGs= 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 C6F0F1C01; Mon, 9 Mar 2026 03:07:04 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 99AF73F7BD; Mon, 9 Mar 2026 03:07:10 -0700 (PDT) Date: Mon, 9 Mar 2026 10:07:08 +0000 From: Leo Yan To: Daniel Lezcano Cc: 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 , 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 v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include Message-ID: <20260309100708.GN1098637@e132581.arm.com> References: <20260308-tools_build_fix_zero_init-v3-0-6477808123b7@arm.com> <20260308-tools_build_fix_zero_init-v3-4-6477808123b7@arm.com> <2ae5e4e5-a860-4f94-9655-67368d558f86@oss.qualcomm.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=us-ascii Content-Disposition: inline In-Reply-To: <2ae5e4e5-a860-4f94-9655-67368d558f86@oss.qualcomm.com> Hi Daniel, On Mon, Mar 09, 2026 at 09:41:16AM +0100, Daniel Lezcano wrote: [...] > On 3/8/26 17:46, Leo Yan wrote: > > Initialize CFLAGS to the default value before including > > tools/scripts/Makefile.include. > > > > Defer appending EXTRA_CFLAGS to CFLAGS until after including > > Makefile.include, as it may extend EXTRA_CFLAGS in the future. > > > > Signed-off-by: Leo Yan > > --- > > tools/thermal/lib/Makefile | 16 +++++++++------- > > 1 file changed, 9 insertions(+), 7 deletions(-) > > > > diff --git a/tools/thermal/lib/Makefile b/tools/thermal/lib/Makefile > > index 056d212f25cf51cd8c02260fbe2ef28dda5e4acb..1890779f1574ebd9015f3001b9bb31d4bc0ae5ce 100644 > > --- a/tools/thermal/lib/Makefile > > +++ b/tools/thermal/lib/Makefile > > @@ -23,6 +23,14 @@ INSTALL = install > > DESTDIR ?= > > DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' > > +# Defer assigning EXTRA_CFLAGS to CFLAGS until after including > > +# tools/scripts/Makefile.include, as it may add flags to EXTRA_CFLAGS. > > +ifdef EXTRA_CFLAGS > > + CFLAGS := > > +else > > + CFLAGS := -g -Wall > > +endif > > + > > Sorry, I don't get the comment :/ > > Can you clarify the intended purpose with this change ? Sure. Since this series sets EXTRA_CFLAGS in Makefile.include (patch 05). Without this patch, the init behavior of the thermal Makefile may change. For example: make -C tools/thermal/lib/ Before this series, the Makefile initializes: CFLAGS := -g -Wall If _only_ patch 05 is applied, EXTRA_CFLAGS is implicitly set in tools/scripts/Makefile.include to work around compiler bugs. The Makefile would initialize: CFLAGS := $(EXTRA_CFLAGS) This patch preserves the original initialization of CFLAGS, but changes the sequence: CFLAGS := -g -Wall CFLAGS += $(EXTRA_CFLAGS) If $(EXTRA_CFLAGS) is set by Makefile.include, it will be appended. Otherwise, if $(EXTRA_CFLAGS) is empty, the behavior remains unchanged. > and the 'override' directive below ? The override directive is used to override any CFLAGS set on the make command line. This patch does not introduce the directive; it simply follows the existing style. As you can see, the following lines already use the directive when appending options. Thanks, Leo > > include $(srctree)/tools/scripts/Makefile.include > > include $(srctree)/tools/scripts/Makefile.arch > > @@ -39,13 +47,6 @@ libdir = $(prefix)/$(libdir_relative) > > libdir_SQ = $(subst ','\'',$(libdir)) > > libdir_relative_SQ = $(subst ','\'',$(libdir_relative)) > > -# Set compile option CFLAGS > > -ifdef EXTRA_CFLAGS > > - CFLAGS := $(EXTRA_CFLAGS) > > -else > > - CFLAGS := -g -Wall > > -endif > > - > > INCLUDES = \ > > -I/usr/include/libnl3 \ > > -I$(srctree)/tools/lib/thermal/include \ > > @@ -56,6 +57,7 @@ INCLUDES = \ > > -I$(srctree)/tools/include/uapi > > # Append required CFLAGS > > +override CFLAGS += $(EXTRA_CFLAGS) > > override CFLAGS += $(EXTRA_WARNINGS) > > override CFLAGS += -Werror -Wall > > override CFLAGS += -fPIC > > >