From nobody Mon Mar 23 21:28:58 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6362C3B2FE3; Mon, 23 Mar 2026 15:14:18 +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=1774278859; cv=none; b=kyH0Q8Vp7WLsCJqfcAacowk34FLv/9XMhxJK3vP7XgZhod313/qRjxSklyMxaap290De4PRpYTlb5IWjDN6ALMcOOFfPGoFW1Ggh6qsAdXvcG81NzEgCCXYJtAtWEtYRyiLhJGtiOEOTKD+MDuuaKM/ikrQlxmAh7XyHyXHJjpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774278859; c=relaxed/simple; bh=BFehMj28QR2IYXlxOIJtUAyqZ+kYk51QCcp6lZ5W+HY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QV7Bvq+4R6uU2B46+g8veMAr4dNf3WPjBuAZEZ3+ELa9lJV5MZXzjT/zJv7Md4bbKDaeF+s8v+7zm9+geF/6tM7GRErXCECHzLSCuJEncqz7cVwaXWyNLxKmB9vJD7onEzN0d3Gr5/8iWnoFrQc3ul7U/Lsc+wrcSW10zDesL5Q= 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 DAE8B16A3; Mon, 23 Mar 2026 08:14:11 -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 9DD9A3F694; Mon, 23 Mar 2026 08:14:10 -0700 (PDT) From: Leo Yan Date: Mon, 23 Mar 2026 15:13:25 +0000 Subject: [PATCH v6 04/24] tools/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: <20260323-tools_build_fix_zero_init-v6-4-235858c51af9@arm.com> References: <20260323-tools_build_fix_zero_init-v6-0-235858c51af9@arm.com> In-Reply-To: <20260323-tools_build_fix_zero_init-v6-0-235858c51af9@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, linux-perf-users@vger.kernel.org, Leo Yan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774278819; l=1994; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=BFehMj28QR2IYXlxOIJtUAyqZ+kYk51QCcp6lZ5W+HY=; b=XEE2aMp5aLmjQ3GsTDbXJ8ihF3x6Ydn5ONySXwAJA8UURgi2TXFvBPTMZHqRXxmCFbTO+8+44 WI5ZeM1VOxDAlDMWOVUmj6agnbkKnTCxarMVjo8V/OLA/LqJhGrZDN7 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. Acked-by: Daniel Lezcano 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 8c9a37f999b826855dad11c0d9574b41d5b24244..333b711bc7f0f9610e165ff7dc7= 2c42980c59c99 100644 --- a/tools/thermal/lib/Makefile +++ b/tools/thermal/lib/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 - INCLUDES =3D \ -I/usr/include/libnl3 \ -I$(srctree)/tools/lib/thermal/include \ @@ -62,6 +63,7 @@ override CFLAGS +=3D -fPIC override CFLAGS +=3D $(INCLUDES) override CFLAGS +=3D -Wl,-L. override CFLAGS +=3D -Wl,-lthermal +override CFLAGS +=3D $(EXTRA_CFLAGS) =20 all: =20 --=20 2.34.1