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 E12D33B27FF; Mon, 23 Mar 2026 15:14:10 +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=1774278852; cv=none; b=gayxp2ZHl2gI4s+NGN1zvZ/q3OMIGe3PuA3xqYTNgYU6Ej1CjRg/fvT0CpEImUNF5/ob0w8yB0uVh8WGdVOlBVDjqKqVfXBKyAj83NZZ3X/ahBOmdLwxSxfHmRC59kR8Y9Arphy9i/e+6urQhJ9iCEemYPvx/kWSt6AR5WQKz1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774278852; c=relaxed/simple; bh=HHiufcx01zjsi7OxV3Txr2WMedIY5n8R+m3Nlsc8pBA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U6HDkrdkJBAMS/C/34OdyPoOcCfv7gW6Swgvly0U7jipUjiWGKba+dX/BK6hAt574BRPKu+s2TCjKH9R3DFKpDg/hGI8lPCi/RAMVCEQiRHiw26qF/C7ELS0dStUImVSDGavlgv+RZo0H2aNKFpOAkDmhLCTX1vag+p0P0cJL2o= 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 658031756; Mon, 23 Mar 2026 08:14:04 -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 2847E3F694; Mon, 23 Mar 2026 08:14:03 -0700 (PDT) From: Leo Yan Date: Mon, 23 Mar 2026 15:13:24 +0000 Subject: [PATCH v6 03/24] 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: <20260323-tools_build_fix_zero_init-v6-3-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=2051; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=HHiufcx01zjsi7OxV3Txr2WMedIY5n8R+m3Nlsc8pBA=; b=i5YuBBtCcjN1uSCuCzVdTeJuZwYbEKy1ip0iqLL9JBH9QSprjyQ+sZSq88rp3ychtYGBMb/wg t/tEyFSSGe5Bt7cKeVJwlJDUFEA0ltnt1H3dnNdQzXdgzd7nKnEAeto 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/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