* [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option
@ 2026-03-23 15:13 Leo Yan
2026-03-23 15:13 ` [PATCH v6 01/24] tools: lib: thermal: Fix typo Leo Yan
` (25 more replies)
0 siblings, 26 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan,
Bartosz Golaszewski, Jonathan Cameron
GCC-15 doesn't guarantee that a {0} initializer clears the whole union [1].
This may cause bugs if data is not intialized properly.
The kernel enabld the -fzero-init-padding-bits=all option to tackle the
issue, which was merged in commit dce4aab8441d ("kbuild: Use
-fzero-init-padding-bits=all").
This series propagates the same flag to the tools build. It uses
tools/scripts/Makefile.include as the central place to add the
option to EXTRA_CFLAGS and HOST_EXTRACFLAGS for the CC and HOSTCC
compilers. Each project under tools/ appends the variables as needed.
BPF/bpftool related patches will be sent separately, as maintainers
prefer them to go via the BPF tree.
The changes are organized into three parts:
Patches 01 – 04: Fixes for thermal build.
Patch 05: Propagate -fzero-init-padding-bits=all to
EXTRA_CFLAGS and HOST_EXTRACFLAGS for the
CC and HOSTCC compilers, respectively.
Patches 06 – 24: Apply EXTRA_CFLAGS and HOST_EXTRACFLAGS in
project Makefiles.
The change has been verified:
Test 1: Cross compiling perf
host: gcc 15.2.0 (x86_64), target: aarch64-linux-gnu-gcc
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LDFLAGS="-static" \
-C tools/perf VF=1 CORESIGHT=1 NO_JEVENTS=1 DEBUG=1
Test 2: Cross compiling selftest bpf and sched_ext
host: gcc 15.2.0 (x86_64), target: aarch64-linux-gnu-gcc
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
make -C tools/testing/selftests/ TARGETS="bpf sched_ext" SKIP_TARGETS=""
Test 3: Native compiling selftest bpf and sched_ext
host: gcc 15.2.0 (x86_64)
make -C tools/testing/selftests/ TARGETS="bpf sched_ext" SKIP_TARGETS=""
Test 4: BPF CI test (with BPF patches sent separately)
https://github.com/kernel-patches/bpf/actions/runs/23439834394
[1] https://gcc.gnu.org/gcc-15/changes.html
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
Changes in v6:
- Gathered Acked tags (thanks Jonathan!)
- Left out bpftool patches and will send together with other BPF patches (Quentin)
- Added back complete info in cover (Peter.Z)
- Link to v5: https://lore.kernel.org/r/20260318-tools_build_fix_zero_init-v5-0-bbeffd8da199@arm.com
Changes in v5:
- Gathered Acked tags (thanks Daniel, Namhyung, Benjamin!)
- Appended HOST_EXTRACFLAGS after KBUILD_HOSTCFLAGS (Ian)
- Appended CFLAGS for libc-test (Thomas)
- Left out BPF patches and will send out separately (Alexei)
- Rebase on v7.0.0-rc4
- Link to v4: https://lore.kernel.org/r/20260311-tools_build_fix_zero_init-v4-0-9e35bdb99cb3@arm.com
---
Leo Yan (24):
tools: lib: thermal: Fix typo
tools/thermal: Fix typo
tools: lib: thermal: Initialize CFLAGS before including Makefile.include
tools/thermal: Initialize CFLAGS before including Makefile.include
tools build: Append -fzero-init-padding-bits=all to extra cflags
perf build: Append extra host flags
tools build: Append extra host cflags
tools: bootconfig: Append extra cflags
tools: counter: Append extra cflags
tools: dma: Append extra cflags
tools: gpio: Append extra cflags
tools: hv: Append extra cflags
tools: iio: Append extra cflags
tools: mm: Append extra cflags
tools: objtool: Append extra host cflags
tools: power: acpi: Append extra cflags
tools: power: x86/intel-speed-select: Append extra cflags
tools: sched_ext: Append extra cflags
tools: spi: Append extra cflags
tools: tracing: Append extra cflags
tools: usb: Append extra cflags
selftests/hid: Append extra cflags
selftests/nolibc: Append extra cflags
selftests/sched_ext: Append extra cflags
tools/bootconfig/Makefile | 1 +
tools/build/Makefile | 6 ++++--
tools/counter/Makefile | 1 +
tools/dma/Makefile | 1 +
tools/gpio/Makefile | 1 +
tools/hv/Makefile | 1 +
tools/iio/Makefile | 1 +
tools/lib/thermal/Makefile | 20 ++++++++++---------
tools/mm/Makefile | 1 +
tools/objtool/Makefile | 2 ++
tools/perf/Makefile.config | 2 +-
tools/power/acpi/Makefile.config | 1 +
tools/power/x86/intel-speed-select/Makefile | 1 +
tools/sched_ext/Makefile | 1 +
tools/scripts/Makefile.include | 30 +++++++++++++++++++++++++++++
tools/spi/Makefile | 1 +
tools/testing/selftests/hid/Makefile | 1 +
tools/testing/selftests/nolibc/Makefile | 7 +++----
tools/testing/selftests/sched_ext/Makefile | 1 +
tools/thermal/lib/Makefile | 20 ++++++++++---------
tools/tracing/latency/Makefile | 1 +
tools/usb/Makefile | 1 +
22 files changed, 77 insertions(+), 25 deletions(-)
---
base-commit: bfec8e88ff6022b056615ec71506703e7e54de82
change-id: 20260224-tools_build_fix_zero_init-dc5261bd8b8b
Best regards,
--
Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 01/24] tools: lib: thermal: Fix typo
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 02/24] tools/thermal: " Leo Yan
` (24 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
s/CFGLAS/CFLAGS
Fixes: 47c4b0de080a ("tools/lib/thermal: Add a thermal library")
Acked-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/lib/thermal/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lib/thermal/Makefile b/tools/lib/thermal/Makefile
index 41aa7a324ff4d76351b89d7d7cf382df3fc14052..09d8f4ba6a0ab7ab9c99ac7f64d52d0268bee340 100644
--- a/tools/lib/thermal/Makefile
+++ b/tools/lib/thermal/Makefile
@@ -66,8 +66,8 @@ override CFLAGS += -fPIC
override CFLAGS += $(NL3_CFLAGS)
override CFLAGS += $(INCLUDES)
override CFLAGS += -fvisibility=hidden
-override CFGLAS += -Wl,-L.
-override CFGLAS += -Wl,-lthermal
+override CFLAGS += -Wl,-L.
+override CFLAGS += -Wl,-lthermal
all:
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 02/24] tools/thermal: Fix typo
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
2026-03-23 15:13 ` [PATCH v6 01/24] tools: lib: thermal: Fix typo Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 03/24] tools: lib: thermal: Initialize CFLAGS before including Makefile.include Leo Yan
` (23 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
s/CFGLAS/CFLAGS
Fixes: 3b7c5e8adf9c ("tools/thermal: Add util library")
Acked-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/thermal/lib/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/thermal/lib/Makefile b/tools/thermal/lib/Makefile
index 056d212f25cf51cd8c02260fbe2ef28dda5e4acb..8c9a37f999b826855dad11c0d9574b41d5b24244 100644
--- a/tools/thermal/lib/Makefile
+++ b/tools/thermal/lib/Makefile
@@ -60,8 +60,8 @@ override CFLAGS += $(EXTRA_WARNINGS)
override CFLAGS += -Werror -Wall
override CFLAGS += -fPIC
override CFLAGS += $(INCLUDES)
-override CFGLAS += -Wl,-L.
-override CFGLAS += -Wl,-lthermal
+override CFLAGS += -Wl,-L.
+override CFLAGS += -Wl,-lthermal
all:
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 03/24] tools: lib: thermal: Initialize CFLAGS before including Makefile.include
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
2026-03-23 15:13 ` [PATCH v6 01/24] tools: lib: thermal: Fix typo Leo Yan
2026-03-23 15:13 ` [PATCH v6 02/24] tools/thermal: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 04/24] tools/thermal: " Leo Yan
` (22 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
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 <daniel.lezcano@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
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..b55fa42cefa47628b7f2fac32fc08fcd82580a0e 100644
--- a/tools/lib/thermal/Makefile
+++ b/tools/lib/thermal/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
+
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
-
NL3_CFLAGS = $(shell pkg-config --cflags libnl-3.0 2>/dev/null)
ifeq ($(NL3_CFLAGS),)
NL3_CFLAGS = -I/usr/include/libnl3
@@ -68,6 +69,7 @@ override CFLAGS += $(INCLUDES)
override CFLAGS += -fvisibility=hidden
override CFLAGS += -Wl,-L.
override CFLAGS += -Wl,-lthermal
+override CFLAGS += $(EXTRA_CFLAGS)
all:
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 04/24] tools/thermal: Initialize CFLAGS before including Makefile.include
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (2 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 03/24] tools: lib: thermal: Initialize CFLAGS before including Makefile.include Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 05/24] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
` (21 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
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 <daniel.lezcano@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
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..333b711bc7f0f9610e165ff7dc72c42980c59c99 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
+
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 \
@@ -62,6 +63,7 @@ override CFLAGS += -fPIC
override CFLAGS += $(INCLUDES)
override CFLAGS += -Wl,-L.
override CFLAGS += -Wl,-lthermal
+override CFLAGS += $(EXTRA_CFLAGS)
all:
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 05/24] tools build: Append -fzero-init-padding-bits=all to extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (3 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 04/24] tools/thermal: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 06/24] perf build: Append extra host flags Leo Yan
` (20 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
GCC-15 release claims [1]:
{0} initializer in C or C++ for unions no longer guarantees clearing
of the whole union (except for static storage duration initialization),
it just initializes the first union member to zero. If initialization
of the whole union including padding bits is desirable, use {} (valid
in C23 or C++) or use -fzero-init-padding-bits=unions option to
restore old GCC behavior.
As a result, this new behaviour might cause unexpected data when we
initialize a union with using the '{ 0 }' initializer.
Since commit dce4aab8441d ("kbuild: Use -fzero-init-padding-bits=all"),
the kernel has enabled -fzero-init-padding-bits=all to zero padding bits
in unions and structures. This commit applies the same option for tools
building.
The option is not supported by any version older than GCC 15, nor is it
supported by LLVM. This patch adds the cc-option and host-cc-option
functions to dynamically detect compiler option and append it to the
EXTRA_CFLAGS and HOST_EXTRACFLAGS respectively.
[1] https://gcc.gnu.org/gcc-15/changes.html
Acked-by: Quentin Monnet <qmo@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/scripts/Makefile.include | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index b5ecf137febcae59f506e107a7f2e2ad72f4bef4..a2397ceae512c1bc54adb15cb1a111ff34e28e43 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -137,6 +137,36 @@ else
EXTRA_WARNINGS += -Wshadow
endif
+# output directory for tests below
+TMPOUT = .tmp_$$$$
+
+# try-run
+# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
+# Exit code chooses option. "$$TMP" serves as a temporary file and is
+# automatically cleaned up.
+try-run = $(shell set -e; \
+ TMP=$(TMPOUT)/tmp; \
+ trap "rm -rf $(TMPOUT)" EXIT; \
+ mkdir -p $(TMPOUT); \
+ if ($(1)) >/dev/null 2>&1; \
+ then echo "$(2)"; \
+ else echo "$(3)"; \
+ fi)
+
+# cc-option
+# Usage: CFLAGS += $(call cc-option,-march=winchip-c6,-march=i586)
+cc-option = $(call try-run, \
+ $(CC) -Werror $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+
+host-cc-option = $(call try-run, \
+ $(HOSTCC) -Werror $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+
+# Explicitly clear padding bits with the initializer '{ 0 }'
+FLAG_ZERO_INIT := $(call cc-option,-fzero-init-padding-bits=all)
+override EXTRA_CFLAGS += $(FLAG_ZERO_INIT)
+HOST_FLAG_ZERO_INIT := $(call host-cc-option,-fzero-init-padding-bits=all)
+override HOST_EXTRACFLAGS += $(HOST_FLAG_ZERO_INIT)
+
ifneq ($(findstring $(MAKEFLAGS), w),w)
PRINT_DIR = --no-print-directory
else
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 06/24] perf build: Append extra host flags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (4 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 05/24] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 07/24] tools build: Append extra host cflags Leo Yan
` (19 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append HOST_EXTRACFLAGS to HOST_CFLAGS so that additional flags can be
applied to the host compiler.
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/perf/Makefile.config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 15fbba9f4ca8926e4512f0b021d9c9b2ec83847e..c9034aeaf6ce27752fd44432847b52074c4e0f1e 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -17,7 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected)
detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
-HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
+HOSTCFLAGS := $(HOST_EXTRACFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS))
# This is required because the kernel is built with this and some of the code
# borrowed from kernel headers depends on it, e.g. put_unaligned_*().
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 07/24] tools build: Append extra host cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (5 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 06/24] perf build: Append extra host flags Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 08/24] tools: bootconfig: Append extra cflags Leo Yan
` (18 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append HOST_EXTRACFLAGS to HOSTCFLAGS so that additional flags can be
applied to the host compiler.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/build/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/build/Makefile b/tools/build/Makefile
index 3a5a3808ab2a1dedd40f35ea322913e8a0788130..44e50a7c182484e18ff80f4205c49a77e8c8abd9 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -40,14 +40,16 @@ endif
FIXDEP := $(OUTPUT)fixdep
FIXDEP_IN := $(OUTPUT)fixdep-in.o
+HOSTCFLAGS := $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS)
+
# To track fixdep's dependencies properly, fixdep needs to run on itself.
# Build it twice the first time.
$(FIXDEP_IN): FORCE
$(Q)if [ ! -f $(FIXDEP) ]; then \
- $(MAKE) $(build)=fixdep HOSTCFLAGS="$(KBUILD_HOSTCFLAGS)"; \
+ $(MAKE) $(build)=fixdep HOSTCFLAGS="$(HOSTCFLAGS)"; \
rm -f $(FIXDEP).o; \
fi
- $(Q)$(MAKE) $(build)=fixdep HOSTCFLAGS="$(KBUILD_HOSTCFLAGS)"
+ $(Q)$(MAKE) $(build)=fixdep HOSTCFLAGS="$(HOSTCFLAGS)"
$(FIXDEP): $(FIXDEP_IN)
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 08/24] tools: bootconfig: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (6 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 07/24] tools build: Append extra host cflags Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 09/24] tools: counter: " Leo Yan
` (17 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/bootconfig/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
index 90eb47c9d8de67b0ccc74a8de0af3a7e0b97feeb..4490df707585acf356153b78cb87760f622a6190 100644
--- a/tools/bootconfig/Makefile
+++ b/tools/bootconfig/Makefile
@@ -11,6 +11,7 @@ endif
LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
override CFLAGS += -Wall -g -I$(CURDIR)/include
+override CFLAGS += $(EXTRA_CFLAGS)
ALL_TARGETS := bootconfig
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 09/24] tools: counter: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (7 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 08/24] tools: bootconfig: Append extra cflags Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 10/24] tools: dma: " Leo Yan
` (16 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/counter/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/counter/Makefile b/tools/counter/Makefile
index d82d35a520f610260abb43f6ae28e56d73268231..1495c0e03d9c00653a24bc92b24d83340dbb4909 100644
--- a/tools/counter/Makefile
+++ b/tools/counter/Makefile
@@ -14,6 +14,7 @@ MAKEFLAGS += -r
override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include \
-I$(srctree)/tools/include
+override CFLAGS += $(EXTRA_CFLAGS)
ALL_TARGETS := counter_example counter_watch_events
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 10/24] tools: dma: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (8 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 09/24] tools: counter: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 11/24] tools: gpio: " Leo Yan
` (15 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Qinxin Xia <xiaqinxin@huawei.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/dma/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/dma/Makefile b/tools/dma/Makefile
index e4abf37bf020ca613b6dca340299198cb887126a..86d3d2e361110b664b885c0e9423660a2d5e8221 100644
--- a/tools/dma/Makefile
+++ b/tools/dma/Makefile
@@ -17,6 +17,7 @@ endif
MAKEFLAGS += -r
override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
+override CFLAGS += $(EXTRA_CFLAGS)
ALL_TARGETS := dma_map_benchmark
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 11/24] tools: gpio: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (9 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 10/24] tools: dma: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 12/24] tools: hv: " Leo Yan
` (14 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan,
Bartosz Golaszewski
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/gpio/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
index 342e056c8c665ac075041ff7c7ca7ba94c691187..05a0057ec361626f41ca87e5295691364f03d2cb 100644
--- a/tools/gpio/Makefile
+++ b/tools/gpio/Makefile
@@ -17,6 +17,7 @@ endif
MAKEFLAGS += -r
override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
+override CFLAGS += $(EXTRA_CFLAGS)
ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon gpio-watch
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 12/24] tools: hv: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (10 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 11/24] tools: gpio: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 13/24] tools: iio: " Leo Yan
` (13 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/hv/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index 34ffcec264ab0fdf7075d25456ef012cb866796b..a85f2208a8e3c9532b0d2cc750fc2a872ab4bb07 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -18,6 +18,7 @@ MAKEFLAGS += -r
override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
override CFLAGS += -Wno-address-of-packed-member
+override CFLAGS += $(EXTRA_CFLAGS)
ALL_TARGETS := hv_kvp_daemon hv_vss_daemon
ifneq ($(ARCH), aarch64)
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 13/24] tools: iio: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (11 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 12/24] tools: hv: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 14/24] tools: mm: " Leo Yan
` (12 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan, Jonathan Cameron
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/iio/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/iio/Makefile b/tools/iio/Makefile
index 3bcce0b7d10f42208765be83dac047faa2e0ceb1..f0428421792d1cbe5ff71b01b67f23eb908fa714 100644
--- a/tools/iio/Makefile
+++ b/tools/iio/Makefile
@@ -13,6 +13,7 @@ endif
MAKEFLAGS += -r
override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
+override CFLAGS += $(EXTRA_CFLAGS)
ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 14/24] tools: mm: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (12 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 13/24] tools: iio: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 15/24] tools: objtool: Append extra host cflags Leo Yan
` (11 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/mm/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/mm/Makefile b/tools/mm/Makefile
index f5725b5c23aa261994b5b42f37c443bee2edebf2..d48491da2edc95fca57c0707c42961fde7b02072 100644
--- a/tools/mm/Makefile
+++ b/tools/mm/Makefile
@@ -10,6 +10,7 @@ LIB_DIR = ../lib/api
LIBS = $(LIB_DIR)/libapi.a
CFLAGS += -Wall -Wextra -I../lib/ -pthread
+CFLAGS += $(EXTRA_CFLAGS)
LDFLAGS += $(LIBS) -pthread
all: $(BUILD_TARGETS)
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 15/24] tools: objtool: Append extra host cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (13 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 14/24] tools: mm: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 21:52 ` Ian Rogers
2026-03-23 15:13 ` [PATCH v6 16/24] tools: power: acpi: Append extra cflags Leo Yan
` (10 subsequent siblings)
25 siblings, 1 reply; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append HOST_EXTRACFLAGS to HOSTCFLAGS so that additional flags can be
applied to the host compiler.
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/objtool/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index b71d1886022e9b3d9fde52bf73bd502aa20d173e..a41fb2a46217bb14fcd8d0941c99d102945c3f2d 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -60,6 +60,8 @@ INCLUDES := -I$(srctree)/tools/include \
-I$(srctree)/tools/objtool/arch/$(SRCARCH)/include \
-I$(LIBSUBCMD_OUTPUT)/include
+HOSTCFLAGS += $(HOST_EXTRACFLAGS)
+
OBJTOOL_CFLAGS := -std=gnu11 -fomit-frame-pointer -O2 -g $(WARNINGS) \
$(INCLUDES) $(LIBELF_FLAGS) $(LIBXXHASH_CFLAGS) $(HOSTCFLAGS)
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 16/24] tools: power: acpi: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (14 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 15/24] tools: objtool: Append extra host cflags Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 17/24] tools: power: x86/intel-speed-select: " Leo Yan
` (9 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/power/acpi/Makefile.config | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
index cd7106876a5f39dfda38e286c54c3a7c268b34a2..11088deab42ee5a793f978feb9f4f7bb7024c48c 100644
--- a/tools/power/acpi/Makefile.config
+++ b/tools/power/acpi/Makefile.config
@@ -69,6 +69,7 @@ KERNEL_INCLUDE := $(OUTPUT)include
ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
CFLAGS += $(WARNINGS)
+CFLAGS += $(EXTRA_CFLAGS)
MKDIR = mkdir
ifeq ($(strip $(V)),false)
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 17/24] tools: power: x86/intel-speed-select: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (15 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 16/24] tools: power: acpi: Append extra cflags Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 18/24] tools: sched_ext: " Leo Yan
` (8 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/power/x86/intel-speed-select/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/power/x86/intel-speed-select/Makefile b/tools/power/x86/intel-speed-select/Makefile
index 6b299aae2ded89c3a70a3649996e258b98001ee7..5947afce9fde7c054647fa3ee0c661b60b863f29 100644
--- a/tools/power/x86/intel-speed-select/Makefile
+++ b/tools/power/x86/intel-speed-select/Makefile
@@ -20,6 +20,7 @@ NL3_CFLAGS = -I/usr/include/libnl3
endif
override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include $(NL3_CFLAGS)
+override CFLAGS += $(EXTRA_CFLAGS)
override LDFLAGS += -lnl-genl-3 -lnl-3
ALL_TARGETS := intel-speed-select
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 18/24] tools: sched_ext: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (16 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 17/24] tools: power: x86/intel-speed-select: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 19/24] tools: spi: " Leo Yan
` (7 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/sched_ext/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/sched_ext/Makefile b/tools/sched_ext/Makefile
index 21554f0896923fa9c2e5b98c85d65d964152e592..e0d705b2fe0ca763fece5137ea43ccb776d18012 100644
--- a/tools/sched_ext/Makefile
+++ b/tools/sched_ext/Makefile
@@ -92,6 +92,7 @@ endif
CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS) \
-I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \
-I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include
+CFLAGS += $(EXTRA_CFLAGS)
# Silence some warnings when compiled with clang
ifneq ($(LLVM),)
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 19/24] tools: spi: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (17 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 18/24] tools: sched_ext: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 20/24] tools: tracing: " Leo Yan
` (6 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/spi/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/spi/Makefile b/tools/spi/Makefile
index 7fccd245a53515ab019529c8e5e91a044eaaa68b..82f9bc6365911b962422633147b108fabc70a2db 100644
--- a/tools/spi/Makefile
+++ b/tools/spi/Makefile
@@ -13,6 +13,7 @@ endif
MAKEFLAGS += -r
CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
+CFLAGS += $(EXTRA_CFLAGS)
ALL_TARGETS := spidev_test spidev_fdx
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 20/24] tools: tracing: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (18 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 19/24] tools: spi: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 21/24] tools: usb: " Leo Yan
` (5 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/tracing/latency/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/tracing/latency/Makefile b/tools/tracing/latency/Makefile
index 257a56b1899f23837de533353e9c2cebdb6035bd..d32a6a13753035355f0e3a05bf88870b8aa55f64 100644
--- a/tools/tracing/latency/Makefile
+++ b/tools/tracing/latency/Makefile
@@ -57,6 +57,7 @@ ifeq ($(config),1)
endif
CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
+CFLAGS += $(EXTRA_CFLAGS)
export CFLAGS OUTPUT srctree
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 21/24] tools: usb: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (19 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 20/24] tools: tracing: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 22/24] selftests/hid: " Leo Yan
` (4 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/usb/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/usb/Makefile b/tools/usb/Makefile
index c6235667dd46223b646bbab5c82c810221750182..42362dcdf2743dace62a5385a7d2707c42bdd3c0 100644
--- a/tools/usb/Makefile
+++ b/tools/usb/Makefile
@@ -14,6 +14,7 @@ endif
MAKEFLAGS += -r
override CFLAGS += -O2 -Wall -Wextra -g -D_GNU_SOURCE -I$(OUTPUT)include -I$(srctree)/tools/include
+override CFLAGS += $(EXTRA_CFLAGS)
override LDFLAGS += -lpthread
ALL_TARGETS := testusb ffs-test
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 22/24] selftests/hid: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (20 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 21/24] tools: usb: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 23/24] selftests/nolibc: " Leo Yan
` (3 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/testing/selftests/hid/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/hid/Makefile b/tools/testing/selftests/hid/Makefile
index 50ec9e0406abaf316fba232c5da1967e27d0fa9b..686c5f79ca592c2ce94e37b39ab5c3ebe8483f79 100644
--- a/tools/testing/selftests/hid/Makefile
+++ b/tools/testing/selftests/hid/Makefile
@@ -26,6 +26,7 @@ HOSTPKG_CONFIG := pkg-config
CFLAGS += -g -O0 -rdynamic -Wall -Werror -I$(OUTPUT)
CFLAGS += -I$(OUTPUT)/tools/include
+CFLAGS += $(EXTRA_CFLAGS)
LDLIBS += -lelf -lz -lrt -lpthread
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 23/24] selftests/nolibc: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (21 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 22/24] selftests/hid: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 15:13 ` [PATCH v6 24/24] selftests/sched_ext: " Leo Yan
` (2 subsequent siblings)
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Include tools/scripts/Makefile.include, which may provide additional
flags in EXTRA_CFLAGS, and append to CFLAGS.
Since Makefile.include already defines cc-option, remove the redundant
definition and include.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/testing/selftests/nolibc/Makefile | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 0370489d938b540721a4fb814ebb68c463760e73..7b65e6f9840b035c1d8580574fc3145318b278b4 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -3,18 +3,17 @@
TEST_GEN_PROGS := nolibc-test libc-test
include ../lib.mk
-include $(top_srcdir)/scripts/Makefile.compiler
-
-cc-option = $(call __cc-option, $(CC),,$(1),$(2))
+include $(top_srcdir)/tools/scripts/Makefile.include
include Makefile.include
$(OUTPUT)/nolibc-test: CFLAGS = -nostdlib -nostdinc -static \
-isystem $(top_srcdir)/tools/include/nolibc -isystem $(top_srcdir)/usr/include \
- $(CFLAGS_NOLIBC_TEST)
+ $(CFLAGS_NOLIBC_TEST) $(EXTRA_CFLAGS)
$(OUTPUT)/nolibc-test: LDLIBS = $(if $(LLVM),,-lgcc)
$(OUTPUT)/nolibc-test: nolibc-test.c nolibc-test-linkage.c | headers
+$(OUTPUT)/libc-test: CFLAGS += $(EXTRA_CFLAGS)
$(OUTPUT)/libc-test: nolibc-test.c nolibc-test-linkage.c
$(call msg,CC,,$@)
$(Q)$(LINK.c) $^ -o $@
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 24/24] selftests/sched_ext: Append extra cflags
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (22 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 23/24] selftests/nolibc: " Leo Yan
@ 2026-03-23 15:13 ` Leo Yan
2026-03-23 21:56 ` [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Ian Rogers
2026-03-23 22:11 ` Andrew Morton
25 siblings, 0 replies; 28+ messages in thread
From: Leo Yan @ 2026-03-23 15:13 UTC (permalink / raw)
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, Nuno Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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, linux-kernel, linux-perf-users, Leo Yan
Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
the compiler.
Acked-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/testing/selftests/sched_ext/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/sched_ext/Makefile b/tools/testing/selftests/sched_ext/Makefile
index 006300ac6dff88a48104977398d8517753e7e385..2c8fbc9f8666ec4d6f75dbdd7602bd4f2b502aed 100644
--- a/tools/testing/selftests/sched_ext/Makefile
+++ b/tools/testing/selftests/sched_ext/Makefile
@@ -56,6 +56,7 @@ endif
CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS) \
-I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \
-I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include -I$(SCXTOOLSINCDIR)
+CFLAGS += $(EXTRA_CFLAGS)
# Silence some warnings when compiled with clang
ifneq ($(LLVM),)
--
2.34.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v6 15/24] tools: objtool: Append extra host cflags
2026-03-23 15:13 ` [PATCH v6 15/24] tools: objtool: Append extra host cflags Leo Yan
@ 2026-03-23 21:52 ` Ian Rogers
0 siblings, 0 replies; 28+ messages in thread
From: Ian Rogers @ 2026-03-23 21:52 UTC (permalink / raw)
To: Leo Yan
Cc: Arnaldo Carvalho de Melo, 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 Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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,
linux-kernel, linux-perf-users
On Mon, Mar 23, 2026 at 8:15 AM Leo Yan <leo.yan@arm.com> wrote:
>
> Append HOST_EXTRACFLAGS to HOSTCFLAGS so that additional flags can be
> applied to the host compiler.
>
> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> tools/objtool/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> index b71d1886022e9b3d9fde52bf73bd502aa20d173e..a41fb2a46217bb14fcd8d0941c99d102945c3f2d 100644
> --- a/tools/objtool/Makefile
> +++ b/tools/objtool/Makefile
> @@ -60,6 +60,8 @@ INCLUDES := -I$(srctree)/tools/include \
> -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include \
> -I$(LIBSUBCMD_OUTPUT)/include
>
> +HOSTCFLAGS += $(HOST_EXTRACFLAGS)
Sashiko noted here (sharing just for common information, not because I
feel this is necessarily making thigs worse) that:
https://sashiko.dev/#/patchset/20260323-tools_build_fix_zero_init-v6-0-235858c51af9%40arm.com
Will this late addition of HOST_EXTRACFLAGS cause a regression by missing the
feature detection checks that run earlier in the Makefile?
The HAVE_XXHASH feature check uses HOSTCFLAGS inside a shell command:
ifeq ($(ARCH_HAS_KLP),y)
HAVE_XXHASH = $(shell printf "$(pound)include
<xxhash.h>\nXXH3_state_t *state;int main() {}" | \
$(HOSTCC) $(HOSTCFLAGS) -xc - -o /dev/null -lxxhash 2> /dev/null
&& echo y || echo n)
ifeq ($(HAVE_XXHASH),y)
Because this check is evaluated immediately by the ifeq ($(HAVE_XXHASH),y)
conditional, the shell command executes during the Makefile parsing phase.
Since HOST_EXTRACFLAGS is appended here after the feature checks, the earlier
tests will run without these extra flags. If a user provides necessary include
paths via HOST_EXTRACFLAGS to locate xxhash.h, the feature test will fail and
silently disable Kernel Live Patching (BUILD_KLP) support.
Could HOSTCFLAGS be updated earlier in the Makefile, before the feature checks
are evaluated?
Thanks,
Ian
> +
> OBJTOOL_CFLAGS := -std=gnu11 -fomit-frame-pointer -O2 -g $(WARNINGS) \
> $(INCLUDES) $(LIBELF_FLAGS) $(LIBXXHASH_CFLAGS) $(HOSTCFLAGS)
>
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (23 preceding siblings ...)
2026-03-23 15:13 ` [PATCH v6 24/24] selftests/sched_ext: " Leo Yan
@ 2026-03-23 21:56 ` Ian Rogers
2026-03-23 22:11 ` Andrew Morton
25 siblings, 0 replies; 28+ messages in thread
From: Ian Rogers @ 2026-03-23 21:56 UTC (permalink / raw)
To: Leo Yan
Cc: Arnaldo Carvalho de Melo, 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 Sá,
Andy Shevchenko, Andrew Morton, Willy Tarreau,
Thomas Weißschuh, 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,
linux-kernel, linux-perf-users, Bartosz Golaszewski,
Jonathan Cameron
On Mon, Mar 23, 2026 at 8:13 AM Leo Yan <leo.yan@arm.com> wrote:
>
> GCC-15 doesn't guarantee that a {0} initializer clears the whole union [1].
> This may cause bugs if data is not intialized properly.
>
> The kernel enabld the -fzero-init-padding-bits=all option to tackle the
> issue, which was merged in commit dce4aab8441d ("kbuild: Use
> -fzero-init-padding-bits=all").
>
> This series propagates the same flag to the tools build. It uses
> tools/scripts/Makefile.include as the central place to add the
> option to EXTRA_CFLAGS and HOST_EXTRACFLAGS for the CC and HOSTCC
> compilers. Each project under tools/ appends the variables as needed.
>
> BPF/bpftool related patches will be sent separately, as maintainers
> prefer them to go via the BPF tree.
>
> The changes are organized into three parts:
>
> Patches 01 – 04: Fixes for thermal build.
> Patch 05: Propagate -fzero-init-padding-bits=all to
> EXTRA_CFLAGS and HOST_EXTRACFLAGS for the
> CC and HOSTCC compilers, respectively.
> Patches 06 – 24: Apply EXTRA_CFLAGS and HOST_EXTRACFLAGS in
> project Makefiles.
>
> The change has been verified:
>
> Test 1: Cross compiling perf
> host: gcc 15.2.0 (x86_64), target: aarch64-linux-gnu-gcc
>
> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LDFLAGS="-static" \
> -C tools/perf VF=1 CORESIGHT=1 NO_JEVENTS=1 DEBUG=1
>
> Test 2: Cross compiling selftest bpf and sched_ext
> host: gcc 15.2.0 (x86_64), target: aarch64-linux-gnu-gcc
>
> export ARCH=arm64
> export CROSS_COMPILE=aarch64-linux-gnu-
> make -C tools/testing/selftests/ TARGETS="bpf sched_ext" SKIP_TARGETS=""
>
> Test 3: Native compiling selftest bpf and sched_ext
> host: gcc 15.2.0 (x86_64)
>
> make -C tools/testing/selftests/ TARGETS="bpf sched_ext" SKIP_TARGETS=""
>
> Test 4: BPF CI test (with BPF patches sent separately)
>
> https://github.com/kernel-patches/bpf/actions/runs/23439834394
>
> [1] https://gcc.gnu.org/gcc-15/changes.html
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
Acked-by: Ian Rogers <irogers@google.com>
At some point the AI reviews appear to be increasingly off in the
weeds. I believe the nolibc stuff, read-only file system things, etc.
in:
https://sashiko.dev/#/patchset/20260323-tools_build_fix_zero_init-v6-0-235858c51af9%40arm.com
are not a major concern. Thanks for humoring them, they were able to
consider a far wider impact than I could from a snippet of Makefile.
Thanks,
Ian
> ---
> Changes in v6:
> - Gathered Acked tags (thanks Jonathan!)
> - Left out bpftool patches and will send together with other BPF patches (Quentin)
> - Added back complete info in cover (Peter.Z)
> - Link to v5: https://lore.kernel.org/r/20260318-tools_build_fix_zero_init-v5-0-bbeffd8da199@arm.com
>
> Changes in v5:
> - Gathered Acked tags (thanks Daniel, Namhyung, Benjamin!)
> - Appended HOST_EXTRACFLAGS after KBUILD_HOSTCFLAGS (Ian)
> - Appended CFLAGS for libc-test (Thomas)
> - Left out BPF patches and will send out separately (Alexei)
> - Rebase on v7.0.0-rc4
> - Link to v4: https://lore.kernel.org/r/20260311-tools_build_fix_zero_init-v4-0-9e35bdb99cb3@arm.com
>
> ---
> Leo Yan (24):
> tools: lib: thermal: Fix typo
> tools/thermal: Fix typo
> tools: lib: thermal: Initialize CFLAGS before including Makefile.include
> tools/thermal: Initialize CFLAGS before including Makefile.include
> tools build: Append -fzero-init-padding-bits=all to extra cflags
> perf build: Append extra host flags
> tools build: Append extra host cflags
> tools: bootconfig: Append extra cflags
> tools: counter: Append extra cflags
> tools: dma: Append extra cflags
> tools: gpio: Append extra cflags
> tools: hv: Append extra cflags
> tools: iio: Append extra cflags
> tools: mm: Append extra cflags
> tools: objtool: Append extra host cflags
> tools: power: acpi: Append extra cflags
> tools: power: x86/intel-speed-select: Append extra cflags
> tools: sched_ext: Append extra cflags
> tools: spi: Append extra cflags
> tools: tracing: Append extra cflags
> tools: usb: Append extra cflags
> selftests/hid: Append extra cflags
> selftests/nolibc: Append extra cflags
> selftests/sched_ext: Append extra cflags
>
> tools/bootconfig/Makefile | 1 +
> tools/build/Makefile | 6 ++++--
> tools/counter/Makefile | 1 +
> tools/dma/Makefile | 1 +
> tools/gpio/Makefile | 1 +
> tools/hv/Makefile | 1 +
> tools/iio/Makefile | 1 +
> tools/lib/thermal/Makefile | 20 ++++++++++---------
> tools/mm/Makefile | 1 +
> tools/objtool/Makefile | 2 ++
> tools/perf/Makefile.config | 2 +-
> tools/power/acpi/Makefile.config | 1 +
> tools/power/x86/intel-speed-select/Makefile | 1 +
> tools/sched_ext/Makefile | 1 +
> tools/scripts/Makefile.include | 30 +++++++++++++++++++++++++++++
> tools/spi/Makefile | 1 +
> tools/testing/selftests/hid/Makefile | 1 +
> tools/testing/selftests/nolibc/Makefile | 7 +++----
> tools/testing/selftests/sched_ext/Makefile | 1 +
> tools/thermal/lib/Makefile | 20 ++++++++++---------
> tools/tracing/latency/Makefile | 1 +
> tools/usb/Makefile | 1 +
> 22 files changed, 77 insertions(+), 25 deletions(-)
> ---
> base-commit: bfec8e88ff6022b056615ec71506703e7e54de82
> change-id: 20260224-tools_build_fix_zero_init-dc5261bd8b8b
>
> Best regards,
> --
> Leo Yan <leo.yan@arm.com>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
` (24 preceding siblings ...)
2026-03-23 21:56 ` [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Ian Rogers
@ 2026-03-23 22:11 ` Andrew Morton
25 siblings, 0 replies; 28+ messages in thread
From: Andrew Morton @ 2026-03-23 22:11 UTC (permalink / raw)
To: Leo Yan
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 Sá,
Andy Shevchenko, Willy Tarreau, Thomas Weißschuh,
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, linux-kernel, linux-perf-users,
Bartosz Golaszewski, Jonathan Cameron
On Mon, 23 Mar 2026 15:13:21 +0000 Leo Yan <leo.yan@arm.com> wrote:
> GCC-15 doesn't guarantee that a {0} initializer clears the whole union [1].
> This may cause bugs if data is not intialized properly.
>
> The kernel enabld the -fzero-init-padding-bits=all option to tackle the
> issue, which was merged in commit dce4aab8441d ("kbuild: Use
> -fzero-init-padding-bits=all").
>
> This series propagates the same flag to the tools build. It uses
> tools/scripts/Makefile.include as the central place to add the
> option to EXTRA_CFLAGS and HOST_EXTRACFLAGS for the CC and HOSTCC
> compilers. Each project under tools/ appends the variables as needed.
>
> BPF/bpftool related patches will be sent separately, as maintainers
> prefer them to go via the BPF tree.
Some questions from AI review. Some probably legit, some probably not:
https://sashiko.dev/#/patchset/20260323-tools_build_fix_zero_init-v6-0-235858c51af9@arm.com
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2026-03-23 22:11 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-23 15:13 [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Leo Yan
2026-03-23 15:13 ` [PATCH v6 01/24] tools: lib: thermal: Fix typo Leo Yan
2026-03-23 15:13 ` [PATCH v6 02/24] tools/thermal: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 03/24] tools: lib: thermal: Initialize CFLAGS before including Makefile.include Leo Yan
2026-03-23 15:13 ` [PATCH v6 04/24] tools/thermal: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 05/24] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
2026-03-23 15:13 ` [PATCH v6 06/24] perf build: Append extra host flags Leo Yan
2026-03-23 15:13 ` [PATCH v6 07/24] tools build: Append extra host cflags Leo Yan
2026-03-23 15:13 ` [PATCH v6 08/24] tools: bootconfig: Append extra cflags Leo Yan
2026-03-23 15:13 ` [PATCH v6 09/24] tools: counter: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 10/24] tools: dma: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 11/24] tools: gpio: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 12/24] tools: hv: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 13/24] tools: iio: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 14/24] tools: mm: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 15/24] tools: objtool: Append extra host cflags Leo Yan
2026-03-23 21:52 ` Ian Rogers
2026-03-23 15:13 ` [PATCH v6 16/24] tools: power: acpi: Append extra cflags Leo Yan
2026-03-23 15:13 ` [PATCH v6 17/24] tools: power: x86/intel-speed-select: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 18/24] tools: sched_ext: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 19/24] tools: spi: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 20/24] tools: tracing: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 21/24] tools: usb: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 22/24] selftests/hid: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 23/24] selftests/nolibc: " Leo Yan
2026-03-23 15:13 ` [PATCH v6 24/24] selftests/sched_ext: " Leo Yan
2026-03-23 21:56 ` [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option Ian Rogers
2026-03-23 22:11 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®