From nobody Mon Apr 6 20:12:44 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6612137C908; Wed, 18 Mar 2026 09:17:48 +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=1773825470; cv=none; b=tMwA83K3HHTXqBaXLtM76EpMsdef4pdujhmP9CnNE4TlVtwxrpW4QE89VFIo7/m3eWI059W02LxrMIJaJ/RyxidFuo5S4IQ10AJxU9f2gjizJup7sYOslS5YoMFwpTd7FOYxO8vp7d1w32/u4yZ4j9KL+zTxyOXa9qXrUm+Nj50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773825470; c=relaxed/simple; bh=BFehMj28QR2IYXlxOIJtUAyqZ+kYk51QCcp6lZ5W+HY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z95bmryPteQA7RUepi0YpfjM7ns6Xmge7az1KSFDfoyZGnZ88InnH5RulyFZaB32V2e9vF7dzjRK4RWm+sLbpA98QMmhuTgVfXCc0plYaMvJ+DshFXJ83F72yqmaBGpwTi2UXWre97Z5OxIQ/w61rK8u7V8vEWbUQQKy+GBc984= 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 E27501F91; Wed, 18 Mar 2026 02:17:41 -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 1131C3F73B; Wed, 18 Mar 2026 02:17:38 -0700 (PDT) From: Leo Yan Date: Wed, 18 Mar 2026 09:16:48 +0000 Subject: [PATCH v5 04/26] 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: <20260318-tools_build_fix_zero_init-v5-4-bbeffd8da199@arm.com> References: <20260318-tools_build_fix_zero_init-v5-0-bbeffd8da199@arm.com> In-Reply-To: <20260318-tools_build_fix_zero_init-v5-0-bbeffd8da199@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=1773825421; l=1994; i=leo.yan@arm.com; s=20250604; h=from:subject:message-id; bh=BFehMj28QR2IYXlxOIJtUAyqZ+kYk51QCcp6lZ5W+HY=; b=JLWXSP7iMG5YIw+3JDlGnZF54Txs+/ERqkdweKC7P+NWPLxHe7vm0cHo9mdMyugjMYOOWxM13 +5w7ubrXUHYC1pHU4fsvgmwjfauhT02fheUq0GvReC1tjta/W0AFHAG 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