public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option
@ 2026-03-18  9:16 Leo Yan
  2026-03-18  9:16 ` [PATCH v5 01/26] tools: lib: thermal: Fix typo Leo Yan
                   ` (27 more replies)
  0 siblings, 28 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, linux-perf-users, Leo Yan,
	Bartosz Golaszewski

Thank you for reviewing and commenting on v4.

For anyone new to the series, the reason for appending this compiler
option is described in v3 (see "Link to v3" below).

In this version, the BPF related patches have been split out and will be
sent separately (note that I have kept the bpftool patches in this
series, as I have gathered Quentin's Acked-by tags).

The changes are organized into three parts:

  Patches 01 – 05: Preparation before adding the new compiler option.
                   Fix typos, adjust Makefiles to ensure the newly
                   introduced option does not cause regressions.
  Patch 06:        Propagate -fzero-init-padding-bits=all to
                   EXTRA_CFLAGS and HOST_EXTRACFLAGS for the
                   CC and HOSTCC compilers, respectively.
  Patches 07 – 26: 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=""

Signed-off-by: Leo Yan <leo.yan@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

Changes in v4:
- Placed EXTRA_CFLAGS last so it can override the default options (Ian).
- Cached evaluated values to avoid invoking cc-option when each
  reference EXTRA_CFLAGS/HOST_EXTRACFLAGS (Ian).
- Dropped useless patches for feature, verification and nolibc
  (Gabriele / Ian / Thomas).
- Fixed typos for thermal (Ian).
- Removed duplicate $(CLANG_CROSS_FLAGS) in libbpf (Ian).
- Collected maintainers' reviewed and ACK tags.
- Link to v3: https://lore.kernel.org/r/20260308-tools_build_fix_zero_init-v3-0-6477808123b7@arm.com

---
Leo Yan (26):
      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
      bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
      tools build: Append -fzero-init-padding-bits=all to extra cflags
      bpftool: Append extra host flags
      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/bpf/bpftool/Makefile                  |  9 +++++++--
 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 +
 23 files changed, 84 insertions(+), 27 deletions(-)
---
base-commit: a989fde763f4f24209e4702f50a45be572340e68
change-id: 20260224-tools_build_fix_zero_init-dc5261bd8b8b

Best regards,
-- 
Leo Yan <leo.yan@arm.com>


^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH v5 01/26] tools: lib: thermal: Fix typo
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 02/26] tools/thermal: " Leo Yan
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 02/26] tools/thermal: Fix typo
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
  2026-03-18  9:16 ` [PATCH v5 01/26] tools: lib: thermal: Fix typo Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 03/26] tools: lib: thermal: Initialize CFLAGS before including Makefile.include Leo Yan
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 03/26] tools: lib: thermal: Initialize CFLAGS before including Makefile.include
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
  2026-03-18  9:16 ` [PATCH v5 01/26] tools: lib: thermal: Fix typo Leo Yan
  2026-03-18  9:16 ` [PATCH v5 02/26] tools/thermal: " Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 04/26] tools/thermal: " Leo Yan
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 04/26] tools/thermal: Initialize CFLAGS before including Makefile.include
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (2 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 03/26] tools: lib: thermal: Initialize CFLAGS before including Makefile.include Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 05/26] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 05/26] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (3 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 04/26] tools/thermal: " Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 06/26] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, linux-perf-users, Leo Yan

Prepare for future changes where EXTRA_CFLAGS may include flags not
applicable to the host compiler.

Move the HOST_CFLAGS assignment before appending EXTRA_CFLAGS to
CFLAGS so that HOST_CFLAGS does not inherit flags from EXTRA_CFLAGS.

Acked-by: Quentin Monnet <qmo@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/bpf/bpftool/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 519ea5cb8ab1c0ee31acc67fc5f96b40e21005c2..3e7d8359e1b2a81a29a47544be8539e3b191a0e8 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -81,6 +81,12 @@ CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
 ifneq ($(BPFTOOL_VERSION),)
 CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"'
 endif
+
+# This must be done before appending EXTRA_CFLAGS to CFLAGS to avoid
+# including flags that are not applicable to the host compiler.
+HOST_CFLAGS := $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE),\
+		$(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS)))
+
 ifneq ($(EXTRA_CFLAGS),)
 CFLAGS += $(EXTRA_CFLAGS)
 endif
@@ -88,8 +94,6 @@ ifneq ($(EXTRA_LDFLAGS),)
 LDFLAGS += $(EXTRA_LDFLAGS)
 endif
 
-HOST_CFLAGS := $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE),\
-		$(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS)))
 HOST_LDFLAGS := $(LDFLAGS)
 
 INSTALL ?= install

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v5 06/26] tools build: Append -fzero-init-padding-bits=all to extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (4 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 05/26] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18 16:38   ` Ian Rogers
  2026-03-18  9:16 ` [PATCH v5 07/26] bpftool: Append extra host flags Leo Yan
                   ` (21 subsequent siblings)
  27 siblings, 1 reply; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 07/26] bpftool: Append extra host flags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (5 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 06/26] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 08/26] perf build: " Leo Yan
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, linux-perf-users, Leo Yan

Append HOST_EXTRACFLAGS to HOST_CFLAGS so that additional flags can be
applied to the host compiler.

Acked-by: Quentin Monnet <qmo@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/bpf/bpftool/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 3e7d8359e1b2a81a29a47544be8539e3b191a0e8..762fcf0e62a189625053798dddeaf17d409fe248 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -86,6 +86,7 @@ endif
 # including flags that are not applicable to the host compiler.
 HOST_CFLAGS := $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE),\
 		$(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS)))
+HOST_CFLAGS += $(HOST_EXTRACFLAGS)
 
 ifneq ($(EXTRA_CFLAGS),)
 CFLAGS += $(EXTRA_CFLAGS)

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v5 08/26] perf build: Append extra host flags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (6 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 07/26] bpftool: Append extra host flags Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 09/26] tools build: Append extra host cflags Leo Yan
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 09/26] tools build: Append extra host cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (7 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 08/26] perf build: " Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 10/26] tools: bootconfig: Append extra cflags Leo Yan
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 10/26] tools: bootconfig: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (8 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 09/26] tools build: Append extra host cflags Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 11/26] tools: counter: " Leo Yan
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 11/26] tools: counter: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (9 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 10/26] tools: bootconfig: Append extra cflags Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 12/26] tools: dma: " Leo Yan
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 12/26] tools: dma: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (10 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 11/26] tools: counter: " Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 13/26] tools: gpio: " Leo Yan
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 13/26] tools: gpio: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (11 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 12/26] tools: dma: " Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 14/26] tools: hv: " Leo Yan
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 14/26] tools: hv: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (12 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 13/26] tools: gpio: " Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:16 ` [PATCH v5 15/26] tools: iio: " Leo Yan
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 15/26] tools: iio: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (13 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 14/26] tools: hv: " Leo Yan
@ 2026-03-18  9:16 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 16/26] tools: mm: " Leo Yan
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:16 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, llvm, bpf, 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/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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 16/26] tools: mm: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (14 preceding siblings ...)
  2026-03-18  9:16 ` [PATCH v5 15/26] tools: iio: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 17/26] tools: objtool: Append extra host cflags Leo Yan
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 17/26] tools: objtool: Append extra host cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (15 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 16/26] tools: mm: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 18/26] tools: power: acpi: Append extra cflags Leo Yan
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 18/26] tools: power: acpi: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (16 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 17/26] tools: objtool: Append extra host cflags Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 19/26] tools: power: x86/intel-speed-select: " Leo Yan
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 19/26] tools: power: x86/intel-speed-select: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (17 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 18/26] tools: power: acpi: Append extra cflags Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 20/26] tools: sched_ext: " Leo Yan
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 20/26] tools: sched_ext: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (18 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 19/26] tools: power: x86/intel-speed-select: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 21/26] tools: spi: " Leo Yan
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 21/26] tools: spi: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (19 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 20/26] tools: sched_ext: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 22/26] tools: tracing: " Leo Yan
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 22/26] tools: tracing: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (20 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 21/26] tools: spi: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 23/26] tools: usb: " Leo Yan
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 23/26] tools: usb: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (21 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 22/26] tools: tracing: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 24/26] selftests/hid: " Leo Yan
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 24/26] selftests/hid: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (22 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 23/26] tools: usb: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 25/26] selftests/nolibc: " Leo Yan
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 25/26] selftests/nolibc: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (23 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 24/26] selftests/hid: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18  9:17 ` [PATCH v5 26/26] selftests/sched_ext: " Leo Yan
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* [PATCH v5 26/26] selftests/sched_ext: Append extra cflags
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (24 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 25/26] selftests/nolibc: " Leo Yan
@ 2026-03-18  9:17 ` Leo Yan
  2026-03-18 11:53 ` [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Peter Zijlstra
  2026-03-18 14:56 ` Quentin Monnet
  27 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18  9:17 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, llvm, bpf, 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 related	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (25 preceding siblings ...)
  2026-03-18  9:17 ` [PATCH v5 26/26] selftests/sched_ext: " Leo Yan
@ 2026-03-18 11:53 ` Peter Zijlstra
  2026-03-18 15:13   ` Leo Yan
  2026-03-18 14:56 ` Quentin Monnet
  27 siblings, 1 reply; 33+ messages in thread
From: Peter Zijlstra @ 2026-03-18 11:53 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,
	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, llvm, bpf, linux-perf-users, Bartosz Golaszewski

On Wed, Mar 18, 2026 at 09:16:44AM +0000, Leo Yan wrote:
> Thank you for reviewing and commenting on v4.
> 
> For anyone new to the series, the reason for appending this compiler
> option is described in v3 (see "Link to v3" below).

So why can't you just copy-paste that yourself, and save me from having
to go find a browser and copy/paste the stupid link, just to find
something that should have been here to begin with?!

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option
  2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (26 preceding siblings ...)
  2026-03-18 11:53 ` [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Peter Zijlstra
@ 2026-03-18 14:56 ` Quentin Monnet
  2026-03-18 15:09   ` Leo Yan
  27 siblings, 1 reply; 33+ messages in thread
From: Quentin Monnet @ 2026-03-18 14:56 UTC (permalink / raw)
  To: Leo Yan, Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim,
	James Clark, Kees Cook, 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, llvm, bpf, linux-perf-users,
	Bartosz Golaszewski

2026-03-18 09:16 UTC+0000 ~ Leo Yan <leo.yan@arm.com>
> Thank you for reviewing and commenting on v4.
> 
> For anyone new to the series, the reason for appending this compiler
> option is described in v3 (see "Link to v3" below).
> 
> In this version, the BPF related patches have been split out and will be
> sent separately (note that I have kept the bpftool patches in this
> series, as I have gathered Quentin's Acked-by tags).


Hi Leo, if it's all the same to you, could bpftool patches go through
the bpf-next tree as well, please? (You can keep my tags, of course.)

Thanks,
Quentin

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option
  2026-03-18 14:56 ` Quentin Monnet
@ 2026-03-18 15:09   ` Leo Yan
  0 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18 15:09 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, 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, llvm, bpf, linux-perf-users, Bartosz Golaszewski

On Wed, Mar 18, 2026 at 02:56:24PM +0000, Quentin Monnet wrote:
> 2026-03-18 09:16 UTC+0000 ~ Leo Yan <leo.yan@arm.com>
> > Thank you for reviewing and commenting on v4.
> > 
> > For anyone new to the series, the reason for appending this compiler
> > option is described in v3 (see "Link to v3" below).
> > 
> > In this version, the BPF related patches have been split out and will be
> > sent separately (note that I have kept the bpftool patches in this
> > series, as I have gathered Quentin's Acked-by tags).
> 
> 
> Hi Leo, if it's all the same to you, could bpftool patches go through
> the bpf-next tree as well, please? (You can keep my tags, of course.)

Sure!

I need to look into BPF CI failures, seems the extra cflags causes
regressions in eBPF selftest [1][2].  After make things clear, I will
send patch series separately (a common one and a BPF one).

Thanks,
Leo

[1] https://github.com/kernel-patches/bpf/actions/runs/23238743267/job/67551317220
[2] https://github.com/kernel-patches/bpf/actions/runs/23238743267/job/67551683133

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option
  2026-03-18 11:53 ` [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Peter Zijlstra
@ 2026-03-18 15:13   ` Leo Yan
  0 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-18 15:13 UTC (permalink / raw)
  To: Peter Zijlstra
  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,
	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, llvm, bpf, linux-perf-users, Bartosz Golaszewski

On Wed, Mar 18, 2026 at 12:53:25PM +0100, Peter Zijlstra wrote:
> On Wed, Mar 18, 2026 at 09:16:44AM +0000, Leo Yan wrote:
> > Thank you for reviewing and commenting on v4.
> > 
> > For anyone new to the series, the reason for appending this compiler
> > option is described in v3 (see "Link to v3" below).
> 
> So why can't you just copy-paste that yourself, and save me from having
> to go find a browser and copy/paste the stupid link, just to find
> something that should have been here to begin with?!

Sorry about that!

I didn't expect a link to cause trouble.  I'll include the information
instead later.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v5 06/26] tools build: Append -fzero-init-padding-bits=all to extra cflags
  2026-03-18  9:16 ` [PATCH v5 06/26] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
@ 2026-03-18 16:38   ` Ian Rogers
  2026-03-23 14:23     ` Leo Yan
  0 siblings, 1 reply; 33+ messages in thread
From: Ian Rogers @ 2026-03-18 16:38 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, llvm, bpf,
	linux-perf-users

On Wed, Mar 18, 2026 at 2:18 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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)

Sashiko [1] noted a possibly unintended consequence of this change for libbpf:

Does this override unintentionally drop the default compiler flags for libbpf?

Looking at tools/lib/bpf/Makefile, the default compiler flags like -g and -O2
are only applied if EXTRA_CFLAGS is undefined:

tools/lib/bpf/Makefile:
ifndef EXTRA_CFLAGS
EXTRA_CFLAGS := -g -O2
endif

Since tools/scripts/Makefile.include unconditionally appends to EXTRA_CFLAGS
here, the variable will be defined before tools/lib/bpf/Makefile evaluates it.

This causes libbpf to silently drop the default -g and -O2 flags.

While later commits in this series fix this exact issue for
tools/lib/thermal/Makefile, it appears tools/lib/bpf/Makefile was missed.

Thanks,
Ian

[1] https://sashiko.dev/#/patchset/20260318-tools_build_fix_zero_init-v5-0-bbeffd8da199%40arm.com

> +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] 33+ messages in thread

* Re: [PATCH v5 06/26] tools build: Append -fzero-init-padding-bits=all to extra cflags
  2026-03-18 16:38   ` Ian Rogers
@ 2026-03-23 14:23     ` Leo Yan
  0 siblings, 0 replies; 33+ messages in thread
From: Leo Yan @ 2026-03-23 14:23 UTC (permalink / raw)
  To: Ian Rogers
  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, llvm, bpf,
	linux-perf-users

Hi Ian,

On Wed, Mar 18, 2026 at 09:38:43AM -0700, Ian Rogers wrote:

[...]

> >  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)
> 
> Sashiko [1] noted a possibly unintended consequence of this change for libbpf:
> 
> Does this override unintentionally drop the default compiler flags for libbpf?
> 
> Looking at tools/lib/bpf/Makefile, the default compiler flags like -g and -O2
> are only applied if EXTRA_CFLAGS is undefined:
> 
> tools/lib/bpf/Makefile:
> ifndef EXTRA_CFLAGS
> EXTRA_CFLAGS := -g -O2
> endif
> 
> Since tools/scripts/Makefile.include unconditionally appends to EXTRA_CFLAGS
> here, the variable will be defined before tools/lib/bpf/Makefile evaluates it.
> 
> This causes libbpf to silently drop the default -g and -O2 flags.
> 
> While later commits in this series fix this exact issue for
> tools/lib/thermal/Makefile, it appears tools/lib/bpf/Makefile was missed.

This is expected.  As Alexei suggested, BPF patches should go via the bpf
tree and be sent separately [2].  As a result, the AI review has no full
context and misses the BPF pieces.

I will send a new series and a BPF/bpftool series separately.  If AI still
complains this, I'd suggest we simply ignore this false positive.

Thanks,
Leo

[2] https://lore.kernel.org/linux-perf-users/CAADnVQLN6bYHnusnC5QnDoGGUO-A=qnM6fP9bhEVXEHD6_y9EQ@mail.gmail.com/#t


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2026-03-23 14:23 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18  9:16 [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Leo Yan
2026-03-18  9:16 ` [PATCH v5 01/26] tools: lib: thermal: Fix typo Leo Yan
2026-03-18  9:16 ` [PATCH v5 02/26] tools/thermal: " Leo Yan
2026-03-18  9:16 ` [PATCH v5 03/26] tools: lib: thermal: Initialize CFLAGS before including Makefile.include Leo Yan
2026-03-18  9:16 ` [PATCH v5 04/26] tools/thermal: " Leo Yan
2026-03-18  9:16 ` [PATCH v5 05/26] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
2026-03-18  9:16 ` [PATCH v5 06/26] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
2026-03-18 16:38   ` Ian Rogers
2026-03-23 14:23     ` Leo Yan
2026-03-18  9:16 ` [PATCH v5 07/26] bpftool: Append extra host flags Leo Yan
2026-03-18  9:16 ` [PATCH v5 08/26] perf build: " Leo Yan
2026-03-18  9:16 ` [PATCH v5 09/26] tools build: Append extra host cflags Leo Yan
2026-03-18  9:16 ` [PATCH v5 10/26] tools: bootconfig: Append extra cflags Leo Yan
2026-03-18  9:16 ` [PATCH v5 11/26] tools: counter: " Leo Yan
2026-03-18  9:16 ` [PATCH v5 12/26] tools: dma: " Leo Yan
2026-03-18  9:16 ` [PATCH v5 13/26] tools: gpio: " Leo Yan
2026-03-18  9:16 ` [PATCH v5 14/26] tools: hv: " Leo Yan
2026-03-18  9:16 ` [PATCH v5 15/26] tools: iio: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 16/26] tools: mm: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 17/26] tools: objtool: Append extra host cflags Leo Yan
2026-03-18  9:17 ` [PATCH v5 18/26] tools: power: acpi: Append extra cflags Leo Yan
2026-03-18  9:17 ` [PATCH v5 19/26] tools: power: x86/intel-speed-select: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 20/26] tools: sched_ext: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 21/26] tools: spi: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 22/26] tools: tracing: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 23/26] tools: usb: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 24/26] selftests/hid: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 25/26] selftests/nolibc: " Leo Yan
2026-03-18  9:17 ` [PATCH v5 26/26] selftests/sched_ext: " Leo Yan
2026-03-18 11:53 ` [PATCH v5 00/26] tools build: Append -fzero-init-padding-bits=all option Peter Zijlstra
2026-03-18 15:13   ` Leo Yan
2026-03-18 14:56 ` Quentin Monnet
2026-03-18 15:09   ` Leo Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox