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 713232741DF; Wed, 11 Mar 2026 08:30:21 +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=1773217826; cv=none; b=hul7wgxrmmWZTS1hGb3Xk+hufU/V1za0Q8/HiCtJpwsjkDvhqIGdcLscxWkJi7T3UWGD7RZeWpIx+T4xwqqB4Od9GfX4IYtvrEDClvlgXvnL0t0LeBhGYICVC+tcHbUOWXRqtWItwGqD1LYlayxRy25tmuyFU5AjN8x2EcFfWqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773217826; c=relaxed/simple; bh=mkmGFFMWdiiEQbxcc15mMJc9KkOmMYC/dMkN1+6Ji9s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qJGsZzxrNWpna4FYylvr7qTi4xCIong/bw+wqSAfXOcJ9PKMFSMnuBt4Hh7+5NDCci1UxfEtLl5M74+FuB92Y1hARIpGRovxT6GeWkv77isvBFhEyo/oEakh/enZ8VV4MNXtiUy6Ajm5hwt/dK5l8MyNx2Ennq2CwSNayFfUnl0= 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 9F64A204C; Wed, 11 Mar 2026 01:30:14 -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 664FD3F73B; Wed, 11 Mar 2026 01:30:13 -0700 (PDT) From: Leo Yan Date: Wed, 11 Mar 2026 08:29:28 +0000 Subject: [PATCH v4 03/30] tools: lib: thermal: Initialize CFLAGS before including Makefile.include 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-3-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=1997; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=mkmGFFMWdiiEQbxcc15mMJc9KkOmMYC/dMkN1+6Ji9s=; b=0hVcsSXNi9/47VYLKM1iq+lFejB1rgTLWX7/mNYrGYlGgEGqSFVH6DyiC19WaQkrCczMMA2d0 E2ZRdzf1Ku4AZb5lSGjAAsBeesU5GmmAhfMlw1uF7aeaJs2FW9/bujm X-Developer-Key: i=leo.yan@arm.com; a=ed25519; pk=k4BaDbvkCXzBFA7Nw184KHGP5thju8lKqJYIrOWxDhI= tools/scripts/Makefile.include may expand EXTRA_CFLAGS in a future change. This could alter the initialization of CFLAGS in the thermal Makefile, as the default options "-g -Wall" would never be set once EXTRA_CFLAGS is expanded. Prepare for this by moving the CFLAGS initialization before including tools/scripts/Makefile.include, so it is not affected by the extended EXTRA_CFLAGS. Append EXTRA_CFLAGS to CFLAGS only after including Makefile.include and place it last so that the extra flags propagate properly and can override the default options. Signed-off-by: Leo Yan Acked-by: Daniel Lezcano --- tools/lib/thermal/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/lib/thermal/Makefile b/tools/lib/thermal/Makefile index 09d8f4ba6a0ab7ab9c99ac7f64d52d0268bee340..b55fa42cefa47628b7f2fac32fc= 08fcd82580a0e 100644 --- a/tools/lib/thermal/Makefile +++ b/tools/lib/thermal/Makefile @@ -23,6 +23,14 @@ INSTALL =3D install DESTDIR ?=3D DESTDIR_SQ =3D '$(subst ','\'',$(DESTDIR))' =20 +# 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 :=3D +else + CFLAGS :=3D -g -Wall +endif + include $(srctree)/tools/scripts/Makefile.include include $(srctree)/tools/scripts/Makefile.arch =20 @@ -39,13 +47,6 @@ libdir =3D $(prefix)/$(libdir_relative) libdir_SQ =3D $(subst ','\'',$(libdir)) libdir_relative_SQ =3D $(subst ','\'',$(libdir_relative)) =20 -# Set compile option CFLAGS -ifdef EXTRA_CFLAGS - CFLAGS :=3D $(EXTRA_CFLAGS) -else - CFLAGS :=3D -g -Wall -endif - NL3_CFLAGS =3D $(shell pkg-config --cflags libnl-3.0 2>/dev/null) ifeq ($(NL3_CFLAGS),) NL3_CFLAGS =3D -I/usr/include/libnl3 @@ -68,6 +69,7 @@ override CFLAGS +=3D $(INCLUDES) override CFLAGS +=3D -fvisibility=3Dhidden override CFLAGS +=3D -Wl,-L. override CFLAGS +=3D -Wl,-lthermal +override CFLAGS +=3D $(EXTRA_CFLAGS) =20 all: =20 --=20 2.34.1