public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option
@ 2026-03-08 16:46 Leo Yan
  2026-03-08 16:46 ` [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
                   ` (29 more replies)
  0 siblings, 30 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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 doesn't guarantee that a {0} initializer clears the whole union [1].
This may cause bugs if data is not intialized properly.

The kernel enabld the -fzero-init-padding-bits=all option to tackle the
issue, which was merged in commit dce4aab8441d ("kbuild: Use
-fzero-init-padding-bits=all").

This series propagates the same flag to the tools build.  It uses
tools/scripts/Makefile.include as the central place to add the
option to EXTRA_CFLAGS and HOST_EXTRACFLAGS for the CC and HOSTCC
compilers.  Each project under tools/ appends the variables as needed.

The variable name HOST_EXTRACFLAGS comes from kbuild conventions (see
Documentation/kbuild/makefiles.rst).

This series is divided into three parts:

  Patches 01 – 04: Preparation before adding the new compiler option.
                   These patches adjust Makefiles to ensure the newly
                   introduced option does not cause regressions.
  Patch 05:        Propagate -fzero-init-padding-bits=all to
                   EXTRA_CFLAGS and HOST_EXTRACFLAGS for the
                   CC and HOSTCC compilers, respectively.
  Patches 06 – 30: Apply EXTRA_CFLAGS and HOST_EXTRACFLAGS in
                   project Makefiles.

The change has been verified:

Test 1: cross compiling perf with aarch64 GCC-15.2 [2]:

  ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu- \
       make LDFLAGS="-static" -C tools/perf VF=1 NO_JEVENTS=1 \
       DEBUG=1 V=1 NO_LIBELF=1 NO_LIBTRACEEVENT=1

Test 2: native selftest build on Arm64 machine:

  make -C tools/testing/selftests TARGETS=hid SKIP_TARGETS="" V=1

[1] https://gcc.gnu.org/gcc-15/changes.html
[2] https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
Changes in v3:
- Extended to support cross compilation (Quentin).
- Link to v2: https://lore.kernel.org/r/20260224-tools_build_fix_zero_init-v2-1-b1acc817a01e@arm.com

---
Leo Yan (30):
      bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
      libbpf: Initialize CFLAGS before including Makefile.include
      tools: lib: thermal: Initialize CFLAGS before including Makefile.include
      tools/thermal: Initialize CFLAGS before including Makefile.include
      tools build: Append -fzero-init-padding-bits=all to extra cflags
      bpftool: Append extra host flags
      perf build: Append extra host flags
      tools/bpf: build: Append extra cflags
      tools build: Append extra host cflags
      tools build: Append extra cflags for feature
      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: nolibc: 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
      tools: verification: Append extra cflags
      selftests/bpf: 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/Makefile                             |  1 +
 tools/bpf/bpftool/Makefile                     |  9 +++++++--
 tools/build/Makefile                           |  6 ++++--
 tools/build/feature/Makefile                   |  2 ++
 tools/counter/Makefile                         |  1 +
 tools/dma/Makefile                             |  1 +
 tools/gpio/Makefile                            |  1 +
 tools/hv/Makefile                              |  1 +
 tools/iio/Makefile                             |  1 +
 tools/include/nolibc/Makefile                  |  2 +-
 tools/lib/bpf/Makefile                         | 16 ++++++++-------
 tools/lib/thermal/Makefile                     | 16 ++++++++-------
 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                 | 28 ++++++++++++++++++++++++++
 tools/spi/Makefile                             |  1 +
 tools/testing/selftests/bpf/Makefile           |  1 +
 tools/testing/selftests/hid/Makefile           |  1 +
 tools/testing/selftests/nolibc/Makefile.nolibc |  3 +++
 tools/testing/selftests/sched_ext/Makefile     |  1 +
 tools/thermal/lib/Makefile                     | 16 ++++++++-------
 tools/tracing/latency/Makefile                 |  1 +
 tools/usb/Makefile                             |  1 +
 tools/verification/rv/Makefile                 |  1 +
 29 files changed, 93 insertions(+), 27 deletions(-)
---
base-commit: 4ae12d8bd9a830799db335ee661d6cbc6597f838
change-id: 20260224-tools_build_fix_zero_init-dc5261bd8b8b

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


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

* [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 10:17   ` Quentin Monnet
  2026-03-09 17:40   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 02/30] libbpf: Initialize CFLAGS before including Makefile.include Leo Yan
                   ` (28 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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.

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

* [PATCH v3 02/30] libbpf: Initialize CFLAGS before including Makefile.include
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
  2026-03-08 16:46 ` [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 17:03   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 03/30] tools: lib: thermal: " Leo Yan
                   ` (27 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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

Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.

Defer appending EXTRA_CFLAGS to CFLAGS until after including
Makefile.include, as it may extend EXTRA_CFLAGS in the future.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/lib/bpf/Makefile | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 168140f8e6461bd06db40e23d21a3fb8847ccbf4..76cc802375f67b9d8f589904bd9764040947e5dd 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -49,6 +49,14 @@ man_dir_SQ = '$(subst ','\'',$(man_dir))'
 export man_dir man_dir_SQ INSTALL
 export DESTDIR DESTDIR_SQ
 
+# 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 -O2
+endif
+
 include $(srctree)/tools/scripts/Makefile.include
 
 # copy a bit from Linux kbuild
@@ -70,14 +78,8 @@ LIB_TARGET	= libbpf.a libbpf.so.$(LIBBPF_VERSION)
 LIB_FILE	= libbpf.a libbpf.so*
 PC_FILE		= libbpf.pc
 
-# Set compile option CFLAGS
-ifdef EXTRA_CFLAGS
-  CFLAGS := $(EXTRA_CFLAGS)
-else
-  CFLAGS := -g -O2
-endif
-
 # Append required CFLAGS
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -std=gnu89
 override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
 override CFLAGS += -Werror -Wall

-- 
2.34.1


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

* [PATCH v3 03/30] tools: lib: thermal: Initialize CFLAGS before including Makefile.include
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
  2026-03-08 16:46 ` [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
  2026-03-08 16:46 ` [PATCH v3 02/30] libbpf: Initialize CFLAGS before including Makefile.include Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 15:10   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 04/30] tools/thermal: " Leo Yan
                   ` (26 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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

Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.

Defer appending EXTRA_CFLAGS to CFLAGS until after including
Makefile.include, as it may extend EXTRA_CFLAGS in the future.

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 41aa7a324ff4d76351b89d7d7cf382df3fc14052..50efa97163fc089455161d6b81db13aa0ae41af6 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
@@ -60,6 +61,7 @@ INCLUDES = \
 -I$(srctree)/tools/include/uapi
 
 # Append required CFLAGS
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += $(EXTRA_WARNINGS)
 override CFLAGS += -Werror -Wall
 override CFLAGS += -fPIC

-- 
2.34.1


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

* [PATCH v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (2 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 03/30] tools: lib: thermal: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09  8:41   ` Daniel Lezcano
  2026-03-08 16:46 ` [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
                   ` (25 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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

Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.

Defer appending EXTRA_CFLAGS to CFLAGS until after including
Makefile.include, as it may extend EXTRA_CFLAGS in the future.

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 056d212f25cf51cd8c02260fbe2ef28dda5e4acb..1890779f1574ebd9015f3001b9bb31d4bc0ae5ce 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 \
@@ -56,6 +57,7 @@ INCLUDES = \
 -I$(srctree)/tools/include/uapi
 
 # Append required CFLAGS
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += $(EXTRA_WARNINGS)
 override CFLAGS += -Werror -Wall
 override CFLAGS += -fPIC

-- 
2.34.1


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

* [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (3 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 04/30] tools/thermal: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 10:17   ` Quentin Monnet
  2026-03-09 17:17   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 06/30] bpftool: Append extra host flags Leo Yan
                   ` (24 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/scripts/Makefile.include | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index b5ecf137febcae59f506e107a7f2e2ad72f4bef4..bab3174565f0d1e40ec574a360a0fddcee641f7e 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -137,6 +137,34 @@ 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 }'
+override EXTRA_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
+override HOST_EXTRACFLAGS += $(call host-cc-option,-fzero-init-padding-bits=all)
+
 ifneq ($(findstring $(MAKEFLAGS), w),w)
 PRINT_DIR = --no-print-directory
 else

-- 
2.34.1


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

* [PATCH v3 06/30] bpftool: Append extra host flags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (4 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 10:17   ` Quentin Monnet
  2026-03-08 16:46 ` [PATCH v3 07/30] perf build: " Leo Yan
                   ` (23 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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.

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

* [PATCH v3 07/30] perf build: Append extra host flags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (5 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 06/30] bpftool: Append extra host flags Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-08 16:46 ` [PATCH v3 08/30] tools/bpf: build: Append extra cflags Leo Yan
                   ` (22 subsequent siblings)
  29 siblings, 0 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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.

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 a8dc72cfe48eec52bd9e2352c46c88f5d8047765..f4004ec148a19c784bfe3ee9b5cc3901a3db25a3 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] 77+ messages in thread

* [PATCH v3 08/30] tools/bpf: build: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (6 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 07/30] perf build: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 17:42   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 09/30] tools build: Append extra host cflags Leo Yan
                   ` (21 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/bpf/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index fd2585af1252669c59228af3a77320e449e1a1ab..f7d7978b4e2c1e592f980c2b8153608b9d821d89 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -8,6 +8,7 @@ YACC = bison
 MAKE = make
 INSTALL ?= install
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -Wall -O2
 CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi \
 	  -I$(srctree)/tools/include

-- 
2.34.1


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

* [PATCH v3 09/30] tools build: Append extra host cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (7 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 08/30] tools/bpf: build: Append extra cflags Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-08 16:46 ` [PATCH v3 10/30] tools build: Append extra cflags for feature Leo Yan
                   ` (20 subsequent siblings)
  29 siblings, 0 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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..a86ce3d99e2bb1c005942d9c32191e6eaa55cf50 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -40,14 +40,16 @@ endif
 FIXDEP		:= $(OUTPUT)fixdep
 FIXDEP_IN	:= $(OUTPUT)fixdep-in.o
 
+HOSTCFLAGS	:= $(HOST_EXTRACFLAGS) $(KBUILD_HOSTCFLAGS)
+
 # 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] 77+ messages in thread

* [PATCH v3 10/30] tools build: Append extra cflags for feature
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (8 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 09/30] tools build: Append extra host cflags Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 17:51   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 11/30] tools: bootconfig: Append extra cflags Leo Yan
                   ` (19 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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 feature build.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/build/feature/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1fbcb3ce74d2173072748a417fc63bd9a5b13888..103d8b71e7a4e8d0979242cfc95c1c0b946222b5 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 include ../../scripts/Makefile.include
 
+CFLAGS += $(EXTRA_CFLAGS)
+
 FILES=                                          \
          test-all.bin                           \
          test-backtrace.bin                     \

-- 
2.34.1


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

* [PATCH v3 11/30] tools: bootconfig: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (9 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 10/30] tools build: Append extra cflags for feature Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 12:22   ` Masami Hiramatsu
  2026-03-09 17:53   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 12/30] tools: counter: " Leo Yan
                   ` (18 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/bootconfig/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
index 90eb47c9d8de67b0ccc74a8de0af3a7e0b97feeb..6bbf4dfdb5b56fcb2a43ccda18b59a270778267b 100644
--- a/tools/bootconfig/Makefile
+++ b/tools/bootconfig/Makefile
@@ -10,6 +10,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
 
 LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -Wall -g -I$(CURDIR)/include
 
 ALL_TARGETS := bootconfig

-- 
2.34.1


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

* [PATCH v3 12/30] tools: counter: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (10 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 11/30] tools: bootconfig: Append extra cflags Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 17:55   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 13/30] tools: dma: " Leo Yan
                   ` (17 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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..c0628677af3807bdc331ce2dba92b4e5f1a25b68 100644
--- a/tools/counter/Makefile
+++ b/tools/counter/Makefile
@@ -12,6 +12,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include \
 	 -I$(srctree)/tools/include
 

-- 
2.34.1


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

* [PATCH v3 13/30] tools: dma: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (11 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 12/30] tools: counter: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 12:08   ` Qinxin Xia
  2026-03-09 17:56   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 14/30] tools: gpio: " Leo Yan
                   ` (16 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/dma/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/dma/Makefile b/tools/dma/Makefile
index e4abf37bf020ca613b6dca340299198cb887126a..bdca05c69a8a12a4f9419eed8c1df71adac4f26d 100644
--- a/tools/dma/Makefile
+++ b/tools/dma/Makefile
@@ -16,6 +16,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
 
 ALL_TARGETS := dma_map_benchmark

-- 
2.34.1


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

* [PATCH v3 14/30] tools: gpio: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (12 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 13/30] tools: dma: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09  8:54   ` Bartosz Golaszewski
  2026-03-09 17:57   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 15/30] tools: hv: " Leo Yan
                   ` (15 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/gpio/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
index 342e056c8c665ac075041ff7c7ca7ba94c691187..206fb6c91a569d64b1e4b906ada5ec866323053c 100644
--- a/tools/gpio/Makefile
+++ b/tools/gpio/Makefile
@@ -16,6 +16,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
 
 ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon gpio-watch

-- 
2.34.1


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

* [PATCH v3 15/30] tools: hv: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (13 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 14/30] tools: gpio: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-08 20:28   ` [EXTERNAL] " Haiyang Zhang
  2026-03-09 17:58   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 16/30] tools: iio: " Leo Yan
                   ` (14 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/hv/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index 34ffcec264ab0fdf7075d25456ef012cb866796b..e39c16325b451ee7c2ddc581cc4d168915472ed6 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -16,6 +16,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
 override CFLAGS += -Wno-address-of-packed-member
 

-- 
2.34.1


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

* [PATCH v3 16/30] tools: iio: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (14 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 15/30] tools: hv: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 17:58   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 17/30] tools: mm: " Leo Yan
                   ` (13 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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..c189af6286751d141348957e4d63d33b87410381 100644
--- a/tools/iio/Makefile
+++ b/tools/iio/Makefile
@@ -12,6 +12,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
 
 ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer

-- 
2.34.1


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

* [PATCH v3 17/30] tools: mm: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (15 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 16/30] tools: iio: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 17:59   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 18/30] tools: nolibc: " Leo Yan
                   ` (12 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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..742c1639db0a6f7aee59cf8f4634cb40eacd49b2 100644
--- a/tools/mm/Makefile
+++ b/tools/mm/Makefile
@@ -9,6 +9,7 @@ INSTALL_TARGETS = $(BUILD_TARGETS) thpmaps
 LIB_DIR = ../lib/api
 LIBS = $(LIB_DIR)/libapi.a
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -Wall -Wextra -I../lib/ -pthread
 LDFLAGS += $(LIBS) -pthread
 

-- 
2.34.1


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

* [PATCH v3 18/30] tools: nolibc: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (16 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 17/30] tools: mm: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 22:20   ` Thomas Weißschuh
  2026-03-08 16:46 ` [PATCH v3 19/30] tools: objtool: Append extra host cflags Leo Yan
                   ` (11 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/include/nolibc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index 1958dda988954d8a604b28f5feb75ebb67ee2e14..b7f0385ccba14fdaa08aab6192acf0296b47cdbc 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -105,7 +105,7 @@ headers_standalone: headers
 	$(Q)$(MAKE) -C $(srctree) headers_install INSTALL_HDR_PATH=$(OUTPUT)sysroot
 
 CFLAGS_s390 := -m64
-CFLAGS := $(CFLAGS_$(ARCH))
+CFLAGS := $(CFLAGS_$(ARCH)) $(EXTRA_CFLAGS)
 
 headers_check: headers_standalone
 	$(Q)for header in $(filter-out crt.h std.h,$(all_files)); do \

-- 
2.34.1


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

* [PATCH v3 19/30] tools: objtool: Append extra host cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (17 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 18/30] tools: nolibc: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 20:19   ` Josh Poimboeuf
  2026-03-08 16:46 ` [PATCH v3 20/30] tools: power: acpi: Append extra cflags Leo Yan
                   ` (10 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/objtool/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 76bcd4e85de345048bba0a6e0066c3cf61dac979..716e84cc33eaccb0e4ae592746eb1888edc2f850 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] 77+ messages in thread

* [PATCH v3 20/30] tools: power: acpi: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (18 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 19/30] tools: objtool: Append extra host cflags Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 18:01   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 21/30] tools: power: x86/intel-speed-select: " Leo Yan
                   ` (9 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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..4978c06828af7b0f47e533735ad82c962b7e0765 100644
--- a/tools/power/acpi/Makefile.config
+++ b/tools/power/acpi/Makefile.config
@@ -67,6 +67,7 @@ WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
 
 KERNEL_INCLUDE := $(OUTPUT)include
 ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
 CFLAGS += $(WARNINGS)
 MKDIR = mkdir

-- 
2.34.1


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

* [PATCH v3 21/30] tools: power: x86/intel-speed-select: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (19 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 20/30] tools: power: acpi: Append extra cflags Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 15:59   ` srinivas pandruvada
  2026-03-09 18:02   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 22/30] tools: sched_ext: " Leo Yan
                   ` (8 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/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..61d6e81f3cf1d6427addb4f31c1369ac663ba3d6 100644
--- a/tools/power/x86/intel-speed-select/Makefile
+++ b/tools/power/x86/intel-speed-select/Makefile
@@ -19,6 +19,7 @@ ifeq ($(NL3_CFLAGS),)
 NL3_CFLAGS = -I/usr/include/libnl3
 endif
 
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include $(NL3_CFLAGS)
 override LDFLAGS += -lnl-genl-3 -lnl-3
 

-- 
2.34.1


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

* [PATCH v3 22/30] tools: sched_ext: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (20 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 21/30] tools: power: x86/intel-speed-select: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 18:07   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 23/30] tools: spi: " Leo Yan
                   ` (7 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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..7b97af037ae55981bc84d4a9140766fdf4c62a6c 100644
--- a/tools/sched_ext/Makefile
+++ b/tools/sched_ext/Makefile
@@ -89,6 +89,7 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS)			\
 	  -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)				\
 	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include

-- 
2.34.1


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

* [PATCH v3 23/30] tools: spi: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (21 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 22/30] tools: sched_ext: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-08 23:21   ` Mark Brown
  2026-03-09 18:03   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 24/30] tools: tracing: " Leo Yan
                   ` (6 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/spi/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/spi/Makefile b/tools/spi/Makefile
index 7fccd245a53515ab019529c8e5e91a044eaaa68b..1e3b3f91634cc2561c434c02f812942fa881685f 100644
--- a/tools/spi/Makefile
+++ b/tools/spi/Makefile
@@ -12,6 +12,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
 
 ALL_TARGETS := spidev_test spidev_fdx

-- 
2.34.1


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

* [PATCH v3 24/30] tools: tracing: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (22 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 23/30] tools: spi: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 15:44   ` Steven Rostedt
  2026-03-08 16:46 ` [PATCH v3 25/30] tools: usb: " Leo Yan
                   ` (5 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/tracing/latency/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/tracing/latency/Makefile b/tools/tracing/latency/Makefile
index 257a56b1899f23837de533353e9c2cebdb6035bd..1468640117dd540b2976cbcafb2371ab16e104e9 100644
--- a/tools/tracing/latency/Makefile
+++ b/tools/tracing/latency/Makefile
@@ -56,6 +56,7 @@ ifeq ($(config),1)
   include Makefile.config
 endif
 
+CFLAGS		+= $(EXTRA_CFLAGS)
 CFLAGS		+= $(INCLUDES) $(LIB_INCLUDES)
 
 export CFLAGS OUTPUT srctree

-- 
2.34.1


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

* [PATCH v3 25/30] tools: usb: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (23 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 24/30] tools: tracing: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 18:04   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 26/30] tools: verification: " Leo Yan
                   ` (4 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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..db2ff5b8e5ab7b76e424df32ed5a9458daa5d516 100644
--- a/tools/usb/Makefile
+++ b/tools/usb/Makefile
@@ -13,6 +13,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 
+override CFLAGS += $(EXTRA_CFLAGS)
 override CFLAGS += -O2 -Wall -Wextra -g -D_GNU_SOURCE -I$(OUTPUT)include -I$(srctree)/tools/include
 override LDFLAGS += -lpthread
 

-- 
2.34.1


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

* [PATCH v3 26/30] tools: verification: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (24 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 25/30] tools: usb: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09  6:26   ` Gabriele Monaco
  2026-03-08 16:46 ` [PATCH v3 27/30] selftests/bpf: " Leo Yan
                   ` (3 subsequent siblings)
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/verification/rv/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/verification/rv/Makefile b/tools/verification/rv/Makefile
index 5b898360ba4818b12e8a16c27bd88c75d0076fb9..2882f0e93dca03b31d790b42d2ee3d8f73cc5c8b 100644
--- a/tools/verification/rv/Makefile
+++ b/tools/verification/rv/Makefile
@@ -55,6 +55,7 @@ ifeq ($(config),1)
   include Makefile.config
 endif
 
+CFLAGS		+= $(EXTRA_CFLAGS)
 CFLAGS		+= $(INCLUDES) $(LIB_INCLUDES)
 
 export CFLAGS OUTPUT srctree

-- 
2.34.1


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

* [PATCH v3 27/30] selftests/bpf: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (25 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 26/30] tools: verification: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 18:05   ` Ian Rogers
  2026-03-10 17:50   ` Leo Yan
  2026-03-08 16:46 ` [PATCH v3 28/30] selftests/hid: " Leo Yan
                   ` (2 subsequent siblings)
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/testing/selftests/bpf/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 72a9ba41f95ebb825d25799c07ba3f0311243e45..29dfcdbe98c781b53f1e87dcebecf2027bafcd5d 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -49,6 +49,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -g $(OPT_FLAGS) -rdynamic -std=gnu11				\
 	  -Wall -Werror -fno-omit-frame-pointer				\
 	  -Wno-unused-but-set-variable					\

-- 
2.34.1


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

* [PATCH v3 28/30] selftests/hid: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (26 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 27/30] selftests/bpf: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 18:06   ` Ian Rogers
  2026-03-08 16:46 ` [PATCH v3 29/30] selftests/nolibc: " Leo Yan
  2026-03-08 16:46 ` [PATCH v3 30/30] selftests/sched_ext: " Leo Yan
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/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..d0dfa411af9b56ea3458184b8a81ef61bd44b1fe 100644
--- a/tools/testing/selftests/hid/Makefile
+++ b/tools/testing/selftests/hid/Makefile
@@ -24,6 +24,7 @@ CXX ?= $(CROSS_COMPILE)g++
 
 HOSTPKG_CONFIG := pkg-config
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -g -O0 -rdynamic -Wall -Werror -I$(OUTPUT)
 CFLAGS += -I$(OUTPUT)/tools/include
 

-- 
2.34.1


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

* [PATCH v3 29/30] selftests/nolibc: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (27 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 28/30] selftests/hid: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 22:24   ` Thomas Weißschuh
  2026-03-08 16:46 ` [PATCH v3 30/30] selftests/sched_ext: " Leo Yan
  29 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/testing/selftests/nolibc/Makefile.nolibc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
index f5704193038f7da935d57e0f894970b6e29b78da..e58b2f5eb2b231bb1c194db7365fff7b4e244e5d 100644
--- a/tools/testing/selftests/nolibc/Makefile.nolibc
+++ b/tools/testing/selftests/nolibc/Makefile.nolibc
@@ -252,6 +252,9 @@ endif
 # Modify CFLAGS based on LLVM=
 include $(srctree)/tools/scripts/Makefile.include
 
+# Append EXTRA_CFLAGS if it is set in tools/scripts/Makefile.include
+CFLAGS  += $(EXTRA_CFLAGS)
+
 REPORT  ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
 		/^Total number of errors:/{done++} \
 		END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \

-- 
2.34.1


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

* [PATCH v3 30/30] selftests/sched_ext: Append extra cflags
  2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
                   ` (28 preceding siblings ...)
  2026-03-08 16:46 ` [PATCH v3 29/30] selftests/nolibc: " Leo Yan
@ 2026-03-08 16:46 ` Leo Yan
  2026-03-09 12:45   ` Andrea Righi
  2026-03-09 18:02   ` Ian Rogers
  29 siblings, 2 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-08 16:46 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/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..81d8f4a184245d8c330cf45b75bd868b2a7aa7dc 100644
--- a/tools/testing/selftests/sched_ext/Makefile
+++ b/tools/testing/selftests/sched_ext/Makefile
@@ -53,6 +53,7 @@ ifneq ($(wildcard $(GENHDR)),)
   GENFLAGS := -DHAVE_GENHDR
 endif
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS)			\
 	  -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)				\
 	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include -I$(SCXTOOLSINCDIR)

-- 
2.34.1


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

* RE: [EXTERNAL] [PATCH v3 15/30] tools: hv: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 15/30] tools: hv: " Leo Yan
@ 2026-03-08 20:28   ` Haiyang Zhang
  2026-03-09 17:58   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Haiyang Zhang @ 2026-03-08 20:28 UTC (permalink / raw)
  To: Leo Yan, 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,
	KY Srinivasan, 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@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, bpf@vger.kernel.org,
	linux-perf-users@vger.kernel.org



> -----Original Message-----
> From: Leo Yan <leo.yan@arm.com>
> Sent: Sunday, March 8, 2026 12:46 PM
> To: Arnaldo Carvalho de Melo <acme@kernel.org>; Ian Rogers
> <irogers@google.com>; Namhyung Kim <namhyung@kernel.org>; James Clark
> <james.clark@linaro.org>; Kees Cook <kees@kernel.org>; Quentin Monnet
> <qmo@kernel.org>; Nathan Chancellor <nathan@kernel.org>; Nicolas Schier
> <nsc@kernel.org>; Nick Desaulniers <nick.desaulniers+lkml@gmail.com>; Bill
> Wendling <morbo@google.com>; Justin Stitt <justinstitt@google.com>; Alexei
> Starovoitov <ast@kernel.org>; Daniel Borkmann <daniel@iogearbox.net>;
> Andrii Nakryiko <andrii@kernel.org>; Martin KaFai Lau
> <martin.lau@linux.dev>; Eduard Zingerman <eddyz87@gmail.com>; Song Liu
> <song@kernel.org>; Yonghong Song <yonghong.song@linux.dev>; John Fastabend
> <john.fastabend@gmail.com>; KP Singh <kpsingh@kernel.org>; Stanislav
> Fomichev <sdf@fomichev.me>; Hao Luo <haoluo@google.com>; Jiri Olsa
> <jolsa@kernel.org>; Rafael J. Wysocki <rafael@kernel.org>; Daniel Lezcano
> <daniel.lezcano@kernel.org>; Zhang Rui <rui.zhang@intel.com>; Lukasz Luba
> <lukasz.luba@arm.com>; Peter Zijlstra <peterz@infradead.org>; Ingo Molnar
> <mingo@redhat.com>; Mark Rutland <mark.rutland@arm.com>; Alexander
> Shishkin <alexander.shishkin@linux.intel.com>; Adrian Hunter
> <adrian.hunter@intel.com>; Masami Hiramatsu <mhiramat@kernel.org>; William
> Breathitt Gray <wbg@kernel.org>; Barry Song <baohua@kernel.org>; Qinxin
> Xia <xiaqinxin@huawei.com>; Bartosz Golaszewski <brgl@kernel.org>; Kent
> Gibson <warthog618@gmail.com>; KY Srinivasan <kys@microsoft.com>; Haiyang
> Zhang <haiyangz@microsoft.com>; Wei Liu <wei.liu@kernel.org>; Dexuan Cui
> <DECUI@microsoft.com>; Long Li <longli@microsoft.com>; Jonathan Cameron
> <jic23@kernel.org>; David Lechner <dlechner@baylibre.com>; Nuno Sá
> <nuno.sa@analog.com>; Andy Shevchenko <andy@kernel.org>; Andrew Morton
> <akpm@linux-foundation.org>; Willy Tarreau <w@1wt.eu>; Thomas Weißschuh
> <linux@weissschuh.net>; Josh Poimboeuf <jpoimboe@kernel.org>; Robert Moore
> <robert.moore@intel.com>; Len Brown <lenb@kernel.org>; Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com>; Tejun Heo <tj@kernel.org>; David
> Vernet <void@manifault.com>; Andrea Righi <arighi@nvidia.com>; Changwoo
> Min <changwoo@igalia.com>; Mark Brown <broonie@kernel.org>; Steven Rostedt
> <rostedt@goodmis.org>; Gabriele Monaco <gmonaco@redhat.com>; Shuah Khan
> <shuah@kernel.org>; Jiri Kosina <jikos@kernel.org>; Benjamin Tissoires
> <bentiss@kernel.org>
> Cc: linux-kbuild@vger.kernel.org; linux-kernel@vger.kernel.org;
> llvm@lists.linux.dev; bpf@vger.kernel.org; linux-perf-
> users@vger.kernel.org; Leo Yan <leo.yan@arm.com>
> Subject: [EXTERNAL] [PATCH v3 15/30] tools: hv: Append extra cflags
> 
> [Some people who received this message don't often get email from
> leo.yan@arm.com. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
> 
> 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/hv/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index
> 34ffcec264ab0fdf7075d25456ef012cb866796b..e39c16325b451ee7c2ddc581cc4d1689
> 15472ed6 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -16,6 +16,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
> 
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
>  override CFLAGS += -Wno-address-of-packed-member

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>




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

* Re: [PATCH v3 23/30] tools: spi: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 23/30] tools: spi: " Leo Yan
@ 2026-03-08 23:21   ` Mark Brown
  2026-03-09 18:03   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Mark Brown @ 2026-03-08 23:21 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andrew Morton, Willy Tarreau, Thomas Weißschuh,
	Josh Poimboeuf, Robert Moore, Len Brown, Srinivas Pandruvada,
	Tejun Heo, David Vernet, Andrea Righi, Changwoo Min,
	Steven Rostedt, Gabriele Monaco, Shuah Khan, Jiri Kosina,
	Benjamin Tissoires, linux-kbuild, linux-kernel, llvm, bpf,
	linux-perf-users

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

On Sun, Mar 08, 2026 at 04:46:28PM +0000, Leo Yan wrote:
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 26/30] tools: verification: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 26/30] tools: verification: " Leo Yan
@ 2026-03-09  6:26   ` Gabriele Monaco
  2026-03-10 15:58     ` Leo Yan
  0 siblings, 1 reply; 77+ messages in thread
From: Gabriele Monaco @ 2026-03-09  6:26 UTC (permalink / raw)
  To: Leo Yan, 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, Shuah Khan, Jiri Kosina, Benjamin Tissoires
  Cc: linux-kbuild, linux-kernel, llvm, bpf, linux-perf-users

On Sun, 2026-03-08 at 16:46 +0000, Leo Yan wrote:
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>

Thanks, for the patch, however I don't think this is necessary for RV as
EXTRA_CFLAGS are already appended to CFLAGS elsewhere [1].

Makefile.rv is included after the various Makefile.include, so I presume that's
good to go for the new flags you're appending in this series.
I did a quick check and I see -fzero-init-padding-bits=all by just adding 05/30
of this series.

[1] -
https://elixir.bootlin.com/linux/v6.19.3/source/tools/verification/rv/Makefile.rv#L29

> ---
>  tools/verification/rv/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/verification/rv/Makefile b/tools/verification/rv/Makefile
> index
> 5b898360ba4818b12e8a16c27bd88c75d0076fb9..2882f0e93dca03b31d790b42d2ee3d8f73cc
> 5c8b 100644
> --- a/tools/verification/rv/Makefile
> +++ b/tools/verification/rv/Makefile
> @@ -55,6 +55,7 @@ ifeq ($(config),1)
>    include Makefile.config
>  endif
>  
> +CFLAGS		+= $(EXTRA_CFLAGS)
>  CFLAGS		+= $(INCLUDES) $(LIB_INCLUDES)
>  
>  export CFLAGS OUTPUT srctree


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

* Re: [PATCH v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include
  2026-03-08 16:46 ` [PATCH v3 04/30] tools/thermal: " Leo Yan
@ 2026-03-09  8:41   ` Daniel Lezcano
  2026-03-09 10:07     ` Leo Yan
  0 siblings, 1 reply; 77+ messages in thread
From: Daniel Lezcano @ 2026-03-09  8:41 UTC (permalink / raw)
  To: Leo Yan, 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


Hi Leo,

On 3/8/26 17:46, Leo Yan wrote:
> Initialize CFLAGS to the default value before including
> tools/scripts/Makefile.include.
> 
> Defer appending EXTRA_CFLAGS to CFLAGS until after including
> Makefile.include, as it may extend EXTRA_CFLAGS in the future.
> 
> 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 056d212f25cf51cd8c02260fbe2ef28dda5e4acb..1890779f1574ebd9015f3001b9bb31d4bc0ae5ce 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
> +

Sorry, I don't get the comment :/

Can you clarify the intended purpose with this change and the 'override' 
directive below ?


>   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 \
> @@ -56,6 +57,7 @@ INCLUDES = \
>   -I$(srctree)/tools/include/uapi
>   
>   # Append required CFLAGS
> +override CFLAGS += $(EXTRA_CFLAGS)
>   override CFLAGS += $(EXTRA_WARNINGS)
>   override CFLAGS += -Werror -Wall
>   override CFLAGS += -fPIC
> 


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

* Re: [PATCH v3 14/30] tools: gpio: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 14/30] tools: gpio: " Leo Yan
@ 2026-03-09  8:54   ` Bartosz Golaszewski
  2026-03-09 17:57   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Bartosz Golaszewski @ 2026-03-09  8:54 UTC (permalink / raw)
  To: Leo Yan
  Cc: linux-kbuild, linux-kernel, llvm, bpf, linux-perf-users,
	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

On Sun, 8 Mar 2026 17:46:19 +0100, Leo Yan <leo.yan@arm.com> said:
> 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/gpio/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
> index 342e056c8c665ac075041ff7c7ca7ba94c691187..206fb6c91a569d64b1e4b906ada5ec866323053c 100644
> --- a/tools/gpio/Makefile
> +++ b/tools/gpio/Makefile
> @@ -16,6 +16,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
>
>  ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon gpio-watch
>
> --
> 2.34.1
>
>

Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

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

* Re: [PATCH v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include
  2026-03-09  8:41   ` Daniel Lezcano
@ 2026-03-09 10:07     ` Leo Yan
  2026-03-10 12:00       ` Daniel Lezcano
  0 siblings, 1 reply; 77+ messages in thread
From: Leo Yan @ 2026-03-09 10:07 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	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 Daniel,

On Mon, Mar 09, 2026 at 09:41:16AM +0100, Daniel Lezcano wrote:

[...]

> On 3/8/26 17:46, Leo Yan wrote:
> > Initialize CFLAGS to the default value before including
> > tools/scripts/Makefile.include.
> > 
> > Defer appending EXTRA_CFLAGS to CFLAGS until after including
> > Makefile.include, as it may extend EXTRA_CFLAGS in the future.
> > 
> > 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 056d212f25cf51cd8c02260fbe2ef28dda5e4acb..1890779f1574ebd9015f3001b9bb31d4bc0ae5ce 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
> > +
> 
> Sorry, I don't get the comment :/
> 
> Can you clarify the intended purpose with this change ?

Sure. Since this series sets EXTRA_CFLAGS in Makefile.include (patch 05).
Without this patch, the init behavior of the thermal Makefile may change.

For example:

  make -C tools/thermal/lib/

Before this series, the Makefile initializes:

  CFLAGS := -g -Wall

If _only_ patch 05 is applied, EXTRA_CFLAGS is implicitly set in
tools/scripts/Makefile.include to work around compiler bugs. The
Makefile would initialize:

  CFLAGS := $(EXTRA_CFLAGS)

This patch preserves the original initialization of CFLAGS, but changes
the sequence:

  CFLAGS := -g -Wall
  CFLAGS += $(EXTRA_CFLAGS)

If $(EXTRA_CFLAGS) is set by Makefile.include, it will be appended.
Otherwise, if $(EXTRA_CFLAGS) is empty, the behavior remains unchanged.

>  and the 'override' directive below ?

The override directive is used to override any CFLAGS set on the make
command line.  This patch does not introduce the directive; it simply
follows the existing style.  As you can see, the following lines
already use the directive when appending options.

Thanks,
Leo

> >   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 \
> > @@ -56,6 +57,7 @@ INCLUDES = \
> >   -I$(srctree)/tools/include/uapi
> >   # Append required CFLAGS
> > +override CFLAGS += $(EXTRA_CFLAGS)
> >   override CFLAGS += $(EXTRA_WARNINGS)
> >   override CFLAGS += -Werror -Wall
> >   override CFLAGS += -fPIC
> > 
> 

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

* Re: [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
  2026-03-08 16:46 ` [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
@ 2026-03-09 10:17   ` Quentin Monnet
  2026-03-09 17:40   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Quentin Monnet @ 2026-03-09 10:17 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

2026-03-08 16:46 UTC+0000 ~ Leo Yan <leo.yan@arm.com>
> 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.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>


Acked-by: Quentin Monnet <qmo@kernel.org>

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

* Re: [PATCH v3 06/30] bpftool: Append extra host flags
  2026-03-08 16:46 ` [PATCH v3 06/30] bpftool: Append extra host flags Leo Yan
@ 2026-03-09 10:17   ` Quentin Monnet
  0 siblings, 0 replies; 77+ messages in thread
From: Quentin Monnet @ 2026-03-09 10:17 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

2026-03-08 16:46 UTC+0000 ~ Leo Yan <leo.yan@arm.com>
> Append HOST_EXTRACFLAGS to HOST_CFLAGS so that additional flags can be
> applied to the host compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>


Acked-by: Quentin Monnet <qmo@kernel.org>

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

* Re: [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags
  2026-03-08 16:46 ` [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
@ 2026-03-09 10:17   ` Quentin Monnet
  2026-03-09 17:17   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Quentin Monnet @ 2026-03-09 10:17 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

2026-03-08 16:46 UTC+0000 ~ Leo Yan <leo.yan@arm.com>
> 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
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>


I can't speak for the maintainers of the other tools of course, but as
far as bpftool is concerned, this looks OK to me. Thanks for this work!

Acked-by: Quentin Monnet <qmo@kernel.org>

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

* Re: [PATCH v3 13/30] tools: dma: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 13/30] tools: dma: " Leo Yan
@ 2026-03-09 12:08   ` Qinxin Xia
  2026-03-09 17:56   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Qinxin Xia @ 2026-03-09 12:08 UTC (permalink / raw)
  To: Leo Yan, 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, 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



On 2026/3/9 00:46:18, Leo Yan <leo.yan@arm.com> wrote:
> 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/dma/Makefile | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/dma/Makefile b/tools/dma/Makefile
> index e4abf37bf020ca613b6dca340299198cb887126a..bdca05c69a8a12a4f9419eed8c1df71adac4f26d 100644
> --- a/tools/dma/Makefile
> +++ b/tools/dma/Makefile
> @@ -16,6 +16,7 @@ endif
>   # (this improves performance and avoids hard-to-debug behaviour);
>   MAKEFLAGS += -r
>   
> +override CFLAGS += $(EXTRA_CFLAGS)
>   override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
>   
>   ALL_TARGETS := dma_map_benchmark
> 
Acked-by: Qinxin Xia <xiaqinxin@huawei.com>
-- 
Thanks,
Qinxin


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

* Re: [PATCH v3 11/30] tools: bootconfig: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 11/30] tools: bootconfig: Append extra cflags Leo Yan
@ 2026-03-09 12:22   ` Masami Hiramatsu
  2026-03-09 17:53   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Masami Hiramatsu @ 2026-03-09 12:22 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, 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 Sun, 08 Mar 2026 16:46:16 +0000
Leo Yan <leo.yan@arm.com> wrote:

> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>

This looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thanks,

> ---
>  tools/bootconfig/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
> index 90eb47c9d8de67b0ccc74a8de0af3a7e0b97feeb..6bbf4dfdb5b56fcb2a43ccda18b59a270778267b 100644
> --- a/tools/bootconfig/Makefile
> +++ b/tools/bootconfig/Makefile
> @@ -10,6 +10,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
>  endif
>  
>  LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -Wall -g -I$(CURDIR)/include
>  
>  ALL_TARGETS := bootconfig
> 
> -- 
> 2.34.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* Re: [PATCH v3 30/30] selftests/sched_ext: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 30/30] selftests/sched_ext: " Leo Yan
@ 2026-03-09 12:45   ` Andrea Righi
  2026-03-09 18:02   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Andrea Righi @ 2026-03-09 12:45 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andrew Morton, Willy Tarreau, Thomas Weißschuh,
	Josh Poimboeuf, Robert Moore, Len Brown, Srinivas Pandruvada,
	Tejun Heo, David Vernet, Changwoo Min, Mark Brown, Steven Rostedt,
	Gabriele Monaco, Shuah Khan, Jiri Kosina, Benjamin Tissoires,
	linux-kbuild, linux-kernel, llvm, bpf, linux-perf-users

On Sun, Mar 08, 2026 at 04:46:35PM +0000, Leo Yan wrote:
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>

Acked-by: Andrea Righi <arighi@nvidia.com>

Thanks,
-Andrea

> ---
>  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..81d8f4a184245d8c330cf45b75bd868b2a7aa7dc 100644
> --- a/tools/testing/selftests/sched_ext/Makefile
> +++ b/tools/testing/selftests/sched_ext/Makefile
> @@ -53,6 +53,7 @@ ifneq ($(wildcard $(GENHDR)),)
>    GENFLAGS := -DHAVE_GENHDR
>  endif
>  
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS)			\
>  	  -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)				\
>  	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include -I$(SCXTOOLSINCDIR)
> 
> -- 
> 2.34.1
> 

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

* Re: [PATCH v3 03/30] tools: lib: thermal: Initialize CFLAGS before including Makefile.include
  2026-03-08 16:46 ` [PATCH v3 03/30] tools: lib: thermal: " Leo Yan
@ 2026-03-09 15:10   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 15:10 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 Sun, Mar 8, 2026 at 9:46 AM Leo Yan <leo.yan@arm.com> wrote:
>
> Initialize CFLAGS to the default value before including
> tools/scripts/Makefile.include.
>
> Defer appending EXTRA_CFLAGS to CFLAGS until after including
> Makefile.include, as it may extend EXTRA_CFLAGS in the future.
>
> 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 41aa7a324ff4d76351b89d7d7cf382df3fc14052..50efa97163fc089455161d6b81db13aa0ae41af6 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
> @@ -60,6 +61,7 @@ INCLUDES = \
>  -I$(srctree)/tools/include/uapi
>
>  # Append required CFLAGS
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += $(EXTRA_WARNINGS)
>  override CFLAGS += -Werror -Wall
>  override CFLAGS += -fPIC

The change lgtm. Running this patch through an AI review showed that
what looks like a typo, CFLAGS becoming CFGLAS, is located below:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/thermal/Makefile#n62
```
# Append required CFLAGS
override CFLAGS += $(EXTRA_WARNINGS)
override CFLAGS += -Werror -Wall
override CFLAGS += -fPIC
override CFLAGS += $(NL3_CFLAGS)
override CFLAGS += $(INCLUDES)
override CFLAGS += -fvisibility=hidden
override CFGLAS += -Wl,-L.
override CFGLAS += -Wl,-lthermal
```

Thanks,
Ian

> --
> 2.34.1
>

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

* Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 24/30] tools: tracing: " Leo Yan
@ 2026-03-09 15:44   ` Steven Rostedt
  2026-03-09 16:37     ` Ian Rogers
  0 siblings, 1 reply; 77+ messages in thread
From: Steven Rostedt @ 2026-03-09 15:44 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	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,
	Gabriele Monaco, Shuah Khan, Jiri Kosina, Benjamin Tissoires,
	linux-kbuild, linux-kernel, llvm, bpf, linux-perf-users

On Sun, 08 Mar 2026 16:46:29 +0000
Leo Yan <leo.yan@arm.com> wrote:

> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>

Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

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

* Re: [PATCH v3 21/30] tools: power: x86/intel-speed-select: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 21/30] tools: power: x86/intel-speed-select: " Leo Yan
@ 2026-03-09 15:59   ` srinivas pandruvada
  2026-03-09 18:02   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: srinivas pandruvada @ 2026-03-09 15:59 UTC (permalink / raw)
  To: Leo Yan, 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, 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

On Sun, 2026-03-08 at 16:46 +0000, Leo Yan wrote:
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied
> to
> the compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.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..61d6e81f3cf1d6427addb4f31c1
> 369ac663ba3d6 100644
> --- a/tools/power/x86/intel-speed-select/Makefile
> +++ b/tools/power/x86/intel-speed-select/Makefile
> @@ -19,6 +19,7 @@ ifeq ($(NL3_CFLAGS),)
>  NL3_CFLAGS = -I/usr/include/libnl3
>  endif
>  
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
> $(NL3_CFLAGS)
>  override LDFLAGS += -lnl-genl-3 -lnl-3
>  

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

* Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
  2026-03-09 15:44   ` Steven Rostedt
@ 2026-03-09 16:37     ` Ian Rogers
  2026-03-10 11:48       ` Leo Yan
  0 siblings, 1 reply; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 16:37 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Leo Yan, 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,
	Gabriele Monaco, Shuah Khan, Jiri Kosina, Benjamin Tissoires,
	linux-kbuild, linux-kernel, llvm, bpf, linux-perf-users

On Mon, Mar 9, 2026 at 8:44 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Sun, 08 Mar 2026 16:46:29 +0000
> Leo Yan <leo.yan@arm.com> wrote:
>
> > Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> > the compiler.
> >
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
>
> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Not a problem with the change but running this patch through an AI
agent brought up:

  Should CFLAGS be initialized with default optimization and warning flags
  (e.g., -g -O2 -Wall)?

  Currently, latency-collector is built without these standard compilation
  flags because they are missing from the Makefile. In other commits in this
  series (like for libbpf and thermal), CFLAGS was explicitly initialized to
 -g -O2 or -g -Wall when EXTRA_CFLAGS is not set.

  Additionally, should EXTRA_WARNINGS (provided by
  tools/scripts/Makefile.include) be appended to CFLAGS here, similar to
  how it is done for other tools?

Thanks,
Ian

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

* Re: [PATCH v3 02/30] libbpf: Initialize CFLAGS before including Makefile.include
  2026-03-08 16:46 ` [PATCH v3 02/30] libbpf: Initialize CFLAGS before including Makefile.include Leo Yan
@ 2026-03-09 17:03   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:03 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 Sun, Mar 8, 2026 at 9:46 AM Leo Yan <leo.yan@arm.com> wrote:
>
> Initialize CFLAGS to the default value before including
> tools/scripts/Makefile.include.
>
> Defer appending EXTRA_CFLAGS to CFLAGS until after including
> Makefile.include, as it may extend EXTRA_CFLAGS in the future.
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
>  tools/lib/bpf/Makefile | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 168140f8e6461bd06db40e23d21a3fb8847ccbf4..76cc802375f67b9d8f589904bd9764040947e5dd 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -49,6 +49,14 @@ man_dir_SQ = '$(subst ','\'',$(man_dir))'
>  export man_dir man_dir_SQ INSTALL
>  export DESTDIR DESTDIR_SQ
>
> +# 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 -O2
> +endif
> +
>  include $(srctree)/tools/scripts/Makefile.include
>
>  # copy a bit from Linux kbuild
> @@ -70,14 +78,8 @@ LIB_TARGET   = libbpf.a libbpf.so.$(LIBBPF_VERSION)
>  LIB_FILE       = libbpf.a libbpf.so*
>  PC_FILE                = libbpf.pc
>
> -# Set compile option CFLAGS
> -ifdef EXTRA_CFLAGS
> -  CFLAGS := $(EXTRA_CFLAGS)
> -else
> -  CFLAGS := -g -O2
> -endif
> -
>  # Append required CFLAGS
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -std=gnu89
>  override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
>  override CFLAGS += -Werror -Wall

Not a problem with the change but AI assisted code review noticed
something unusual. Below here is:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/bpf/Makefile#n87
```
override CFLAGS += $(CLANG_CROSS_FLAGS)
```
and $(srctree)/tools/scripts/Makefile.include has when CROSS_COMPILE is set:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/scripts/Makefile.include#n116
```
CFLAGS += $(CLANG_CROSS_FLAGS)
```
so it looks like the CFLAGS is duplicating $(CLANG_CROSS_FLAGS).

Thanks,
Ian

> --
> 2.34.1
>

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

* Re: [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags
  2026-03-08 16:46 ` [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
  2026-03-09 10:17   ` Quentin Monnet
@ 2026-03-09 17:17   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:17 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 Sun, Mar 8, 2026 at 9:47 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
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
>  tools/scripts/Makefile.include | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
> index b5ecf137febcae59f506e107a7f2e2ad72f4bef4..bab3174565f0d1e40ec574a360a0fddcee641f7e 100644
> --- a/tools/scripts/Makefile.include
> +++ b/tools/scripts/Makefile.include
> @@ -137,6 +137,34 @@ 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 }'
> +override EXTRA_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
> +override HOST_EXTRACFLAGS += $(call host-cc-option,-fzero-init-padding-bits=all)

Could this slow down builds, as each reference to EXTRA_CFLAGS and
HOST_EXTRACFLAGS will invoke cc-option, which shells out and runs cc?
Perhaps you could evaluate the values once then reference them
something like:
```makefile
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)
```

Thanks,
Ian

> +
>  ifneq ($(findstring $(MAKEFLAGS), w),w)
>  PRINT_DIR = --no-print-directory
>  else
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
  2026-03-08 16:46 ` [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
  2026-03-09 10:17   ` Quentin Monnet
@ 2026-03-09 17:40   ` Ian Rogers
  2026-03-09 17:51     ` Quentin Monnet
  1 sibling, 1 reply; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:40 UTC (permalink / raw)
  To: Leo Yan, Quentin Monnet
  Cc: Arnaldo Carvalho de Melo, 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

On Sun, Mar 8, 2026 at 9:46 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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.
>
> 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)

This isn't an issue with the patch but AI code review is noting that
"LDFLAGS += $(EXTRA_LDFLAGS)" happens above, and then here,
"HOST_LDFLAGS := $(LDFLAGS)". This means something like
EXTRA_LDFLAGS="--sysroot=/my/target" in the build would cause the host
ld to pick up the --sysroot flag and probably break host builds which
likely use the host `bpftool` when cross-compiling (perf's build
should use the host `bpftool`). If the HOST_LDFLAGS were set to
LDFLAGS before EXTRA_LDFLAGS are appended, this would not be an issue.

Thanks,
Ian

>  INSTALL ?= install
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 08/30] tools/bpf: build: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 08/30] tools/bpf: build: Append extra cflags Leo Yan
@ 2026-03-09 17:42   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:42 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 Sun, Mar 8, 2026 at 9:47 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/bpf/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
> index fd2585af1252669c59228af3a77320e449e1a1ab..f7d7978b4e2c1e592f980c2b8153608b9d821d89 100644
> --- a/tools/bpf/Makefile
> +++ b/tools/bpf/Makefile
> @@ -8,6 +8,7 @@ YACC = bison
>  MAKE = make
>  INSTALL ?= install
>
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -Wall -O2
>  CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi \
>           -I$(srctree)/tools/include

Should appending to CFLAGS happen last so that the user can override
the default CFLAGS values?

Thanks,
Ian

> --
> 2.34.1
>

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

* Re: [PATCH v3 10/30] tools build: Append extra cflags for feature
  2026-03-08 16:46 ` [PATCH v3 10/30] tools build: Append extra cflags for feature Leo Yan
@ 2026-03-09 17:51   ` Ian Rogers
  2026-03-10 14:25     ` Leo Yan
  0 siblings, 1 reply; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:51 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 Sun, Mar 8, 2026 at 9:47 AM Leo Yan <leo.yan@arm.com> wrote:
>
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the feature build.
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
>  tools/build/feature/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 1fbcb3ce74d2173072748a417fc63bd9a5b13888..103d8b71e7a4e8d0979242cfc95c1c0b946222b5 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -1,6 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0
>  include ../../scripts/Makefile.include
>
> +CFLAGS += $(EXTRA_CFLAGS)
> +

Is this necessary? In Makefile.feature:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/build/Makefile.feature#n11
The build invocation does "CFLAGS="$(EXTRA_CFLAGS)" and so the locally
set CFLAGS appear to be ignored.

Thanks,
Ian

>  FILES=                                          \
>           test-all.bin                           \
>           test-backtrace.bin                     \
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
  2026-03-09 17:40   ` Ian Rogers
@ 2026-03-09 17:51     ` Quentin Monnet
  0 siblings, 0 replies; 77+ messages in thread
From: Quentin Monnet @ 2026-03-09 17:51 UTC (permalink / raw)
  To: Ian Rogers, Leo Yan
  Cc: Arnaldo Carvalho de Melo, 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

2026-03-09 10:40 UTC-0700 ~ Ian Rogers <irogers@google.com>
> On Sun, Mar 8, 2026 at 9:46 AM Leo Yan <leo.yan@arm.com> wrote:
>>
>> 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.
>>
>> 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)
> 
> This isn't an issue with the patch but AI code review is noting that
> "LDFLAGS += $(EXTRA_LDFLAGS)" happens above, and then here,
> "HOST_LDFLAGS := $(LDFLAGS)". This means something like
> EXTRA_LDFLAGS="--sysroot=/my/target" in the build would cause the host
> ld to pick up the --sysroot flag and probably break host builds which
> likely use the host `bpftool` when cross-compiling (perf's build
> should use the host `bpftool`). If the HOST_LDFLAGS were set to
> LDFLAGS before EXTRA_LDFLAGS are appended, this would not be an issue.


I noticed it when reviewing, but if the HOST_LDFLAGS were set before
EXTRA_LDFLAGS, we wouldn't be able to pass additional HOST_LDFLAGS via
any "EXTRA_..." variable, which would look inconsistent with how
bpftool's Makefile handles the HOST_CFLAGS. I suppose the right fix
would be to move HOST_LDFLAGS before EXTRA_LDFLAGS as you (and the AI)
suggest, but also to add a HOST_EXTRALDFLAGS to it? Although I've not
heard of any use case for passing different ld flags when
cross-compiling bpftool, yet.

Quentin

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

* Re: [PATCH v3 11/30] tools: bootconfig: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 11/30] tools: bootconfig: Append extra cflags Leo Yan
  2026-03-09 12:22   ` Masami Hiramatsu
@ 2026-03-09 17:53   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:53 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 Sun, Mar 8, 2026 at 9:48 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/bootconfig/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
> index 90eb47c9d8de67b0ccc74a8de0af3a7e0b97feeb..6bbf4dfdb5b56fcb2a43ccda18b59a270778267b 100644
> --- a/tools/bootconfig/Makefile
> +++ b/tools/bootconfig/Makefile
> @@ -10,6 +10,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
>  endif
>
>  LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -Wall -g -I$(CURDIR)/include

Should the EXTRA_CFLAGS be appended last so that the user can override
the default CFLAGS (e.g. switching off warnings) ?

Thanks,
Ian

>  ALL_TARGETS := bootconfig
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 12/30] tools: counter: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 12/30] tools: counter: " Leo Yan
@ 2026-03-09 17:55   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:55 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 Sun, Mar 8, 2026 at 9:48 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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..c0628677af3807bdc331ce2dba92b4e5f1a25b68 100644
> --- a/tools/counter/Makefile
> +++ b/tools/counter/Makefile
> @@ -12,6 +12,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include \
>          -I$(srctree)/tools/include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>
> --
> 2.34.1
>

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

* Re: [PATCH v3 13/30] tools: dma: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 13/30] tools: dma: " Leo Yan
  2026-03-09 12:08   ` Qinxin Xia
@ 2026-03-09 17:56   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:56 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, James Clark, Kees Cook,
	Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andrew Morton, Willy Tarreau, Thomas Weißschuh,
	Josh Poimboeuf, Robert Moore, Len Brown, Srinivas Pandruvada,
	Tejun Heo, David Vernet, Andrea Righi, Changwoo Min, Mark Brown,
	Steven Rostedt, Gabriele Monaco, Shuah Khan, Jiri Kosina,
	Benjamin Tissoires, linux-kbuild, linux-kernel, llvm, bpf,
	linux-perf-users

On Sun, Mar 8, 2026 at 9:48 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/dma/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/dma/Makefile b/tools/dma/Makefile
> index e4abf37bf020ca613b6dca340299198cb887126a..bdca05c69a8a12a4f9419eed8c1df71adac4f26d 100644
> --- a/tools/dma/Makefile
> +++ b/tools/dma/Makefile
> @@ -16,6 +16,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  ALL_TARGETS := dma_map_benchmark
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 14/30] tools: gpio: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 14/30] tools: gpio: " Leo Yan
  2026-03-09  8:54   ` Bartosz Golaszewski
@ 2026-03-09 17:57   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:57 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 Sun, Mar 8, 2026 at 9:48 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/gpio/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
> index 342e056c8c665ac075041ff7c7ca7ba94c691187..206fb6c91a569d64b1e4b906ada5ec866323053c 100644
> --- a/tools/gpio/Makefile
> +++ b/tools/gpio/Makefile
> @@ -16,6 +16,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon gpio-watch
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 15/30] tools: hv: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 15/30] tools: hv: " Leo Yan
  2026-03-08 20:28   ` [EXTERNAL] " Haiyang Zhang
@ 2026-03-09 17:58   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:58 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 Sun, Mar 8, 2026 at 9:48 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/hv/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/hv/Makefile b/tools/hv/Makefile
> index 34ffcec264ab0fdf7075d25456ef012cb866796b..e39c16325b451ee7c2ddc581cc4d168915472ed6 100644
> --- a/tools/hv/Makefile
> +++ b/tools/hv/Makefile
> @@ -16,6 +16,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
>  override CFLAGS += -Wno-address-of-packed-member

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>
> --
> 2.34.1
>

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

* Re: [PATCH v3 16/30] tools: iio: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 16/30] tools: iio: " Leo Yan
@ 2026-03-09 17:58   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:58 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 Sun, Mar 8, 2026 at 9:48 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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..c189af6286751d141348957e4d63d33b87410381 100644
> --- a/tools/iio/Makefile
> +++ b/tools/iio/Makefile
> @@ -12,6 +12,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 17/30] tools: mm: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 17/30] tools: mm: " Leo Yan
@ 2026-03-09 17:59   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 17:59 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 Sun, Mar 8, 2026 at 9:48 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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..742c1639db0a6f7aee59cf8f4634cb40eacd49b2 100644
> --- a/tools/mm/Makefile
> +++ b/tools/mm/Makefile
> @@ -9,6 +9,7 @@ INSTALL_TARGETS = $(BUILD_TARGETS) thpmaps
>  LIB_DIR = ../lib/api
>  LIBS = $(LIB_DIR)/libapi.a
>
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -Wall -Wextra -I../lib/ -pthread

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  LDFLAGS += $(LIBS) -pthread
>
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 20/30] tools: power: acpi: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 20/30] tools: power: acpi: Append extra cflags Leo Yan
@ 2026-03-09 18:01   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:01 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 Sun, Mar 8, 2026 at 9:49 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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..4978c06828af7b0f47e533735ad82c962b7e0765 100644
> --- a/tools/power/acpi/Makefile.config
> +++ b/tools/power/acpi/Makefile.config
> @@ -67,6 +67,7 @@ WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
>
>  KERNEL_INCLUDE := $(OUTPUT)include
>  ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
>  CFLAGS += $(WARNINGS)

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  MKDIR = mkdir
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 21/30] tools: power: x86/intel-speed-select: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 21/30] tools: power: x86/intel-speed-select: " Leo Yan
  2026-03-09 15:59   ` srinivas pandruvada
@ 2026-03-09 18:02   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:02 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 Sun, Mar 8, 2026 at 9:49 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/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..61d6e81f3cf1d6427addb4f31c1369ac663ba3d6 100644
> --- a/tools/power/x86/intel-speed-select/Makefile
> +++ b/tools/power/x86/intel-speed-select/Makefile
> @@ -19,6 +19,7 @@ ifeq ($(NL3_CFLAGS),)
>  NL3_CFLAGS = -I/usr/include/libnl3
>  endif
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include $(NL3_CFLAGS)

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  override LDFLAGS += -lnl-genl-3 -lnl-3
>
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 30/30] selftests/sched_ext: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 30/30] selftests/sched_ext: " Leo Yan
  2026-03-09 12:45   ` Andrea Righi
@ 2026-03-09 18:02   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:02 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 Sun, Mar 8, 2026 at 9:50 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/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..81d8f4a184245d8c330cf45b75bd868b2a7aa7dc 100644
> --- a/tools/testing/selftests/sched_ext/Makefile
> +++ b/tools/testing/selftests/sched_ext/Makefile
> @@ -53,6 +53,7 @@ ifneq ($(wildcard $(GENHDR)),)
>    GENFLAGS := -DHAVE_GENHDR
>  endif
>
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS)                  \
>           -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)                              \
>           -I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include -I$(SCXTOOLSINCDIR)

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

> --
> 2.34.1
>

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

* Re: [PATCH v3 23/30] tools: spi: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 23/30] tools: spi: " Leo Yan
  2026-03-08 23:21   ` Mark Brown
@ 2026-03-09 18:03   ` Ian Rogers
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:03 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 Sun, Mar 8, 2026 at 9:49 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/spi/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/spi/Makefile b/tools/spi/Makefile
> index 7fccd245a53515ab019529c8e5e91a044eaaa68b..1e3b3f91634cc2561c434c02f812942fa881685f 100644
> --- a/tools/spi/Makefile
> +++ b/tools/spi/Makefile
> @@ -12,6 +12,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  ALL_TARGETS := spidev_test spidev_fdx
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 25/30] tools: usb: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 25/30] tools: usb: " Leo Yan
@ 2026-03-09 18:04   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:04 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 Sun, Mar 8, 2026 at 9:50 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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..db2ff5b8e5ab7b76e424df32ed5a9458daa5d516 100644
> --- a/tools/usb/Makefile
> +++ b/tools/usb/Makefile
> @@ -13,6 +13,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>
> +override CFLAGS += $(EXTRA_CFLAGS)
>  override CFLAGS += -O2 -Wall -Wextra -g -D_GNU_SOURCE -I$(OUTPUT)include -I$(srctree)/tools/include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>  override LDFLAGS += -lpthread
>
>
> --
> 2.34.1
>

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

* Re: [PATCH v3 27/30] selftests/bpf: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 27/30] selftests/bpf: " Leo Yan
@ 2026-03-09 18:05   ` Ian Rogers
  2026-03-10 17:50   ` Leo Yan
  1 sibling, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:05 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 Sun, Mar 8, 2026 at 9:50 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/testing/selftests/bpf/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 72a9ba41f95ebb825d25799c07ba3f0311243e45..29dfcdbe98c781b53f1e87dcebecf2027bafcd5d 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -49,6 +49,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
>  srctree := $(patsubst %/,%,$(dir $(srctree)))
>  endif
>
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -g $(OPT_FLAGS) -rdynamic -std=gnu11                         \
>           -Wall -Werror -fno-omit-frame-pointer                         \
>           -Wno-unused-but-set-variable                                  \

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

> --
> 2.34.1
>

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

* Re: [PATCH v3 28/30] selftests/hid: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 28/30] selftests/hid: " Leo Yan
@ 2026-03-09 18:06   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:06 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 Sun, Mar 8, 2026 at 9:50 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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/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..d0dfa411af9b56ea3458184b8a81ef61bd44b1fe 100644
> --- a/tools/testing/selftests/hid/Makefile
> +++ b/tools/testing/selftests/hid/Makefile
> @@ -24,6 +24,7 @@ CXX ?= $(CROSS_COMPILE)g++
>
>  HOSTPKG_CONFIG := pkg-config
>
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -g -O0 -rdynamic -Wall -Werror -I$(OUTPUT)
>  CFLAGS += -I$(OUTPUT)/tools/include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

>
> --
> 2.34.1
>

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

* Re: [PATCH v3 22/30] tools: sched_ext: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 22/30] tools: sched_ext: " Leo Yan
@ 2026-03-09 18:07   ` Ian Rogers
  0 siblings, 0 replies; 77+ messages in thread
From: Ian Rogers @ 2026-03-09 18:07 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 Sun, Mar 8, 2026 at 9:49 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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..7b97af037ae55981bc84d4a9140766fdf4c62a6c 100644
> --- a/tools/sched_ext/Makefile
> +++ b/tools/sched_ext/Makefile
> @@ -89,6 +89,7 @@ ifneq ($(wildcard $(GENHDR)),)
>    GENFLAGS := -DHAVE_GENHDR
>  endif
>
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -g -O2 -rdynamic -pthread -Wall -Werror $(GENFLAGS)                  \
>           -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)                              \
>           -I$(TOOLSINCDIR) -I$(APIDIR) -I$(CURDIR)/include

The append should probably happen last to allow the default values to
be overridden.

Thanks,
Ian

> --
> 2.34.1
>

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

* Re: [PATCH v3 19/30] tools: objtool: Append extra host cflags
  2026-03-08 16:46 ` [PATCH v3 19/30] tools: objtool: Append extra host cflags Leo Yan
@ 2026-03-09 20:19   ` Josh Poimboeuf
  0 siblings, 0 replies; 77+ messages in thread
From: Josh Poimboeuf @ 2026-03-09 20:19 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andrew Morton, Willy Tarreau, Thomas Weißschuh, 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 Sun, Mar 08, 2026 at 04:46:24PM +0000, Leo Yan wrote:
> 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>

Thanks!

Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>

-- 
Josh

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

* Re: [PATCH v3 18/30] tools: nolibc: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 18/30] tools: nolibc: " Leo Yan
@ 2026-03-09 22:20   ` Thomas Weißschuh
  0 siblings, 0 replies; 77+ messages in thread
From: Thomas Weißschuh @ 2026-03-09 22:20 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andrew Morton, Willy Tarreau, 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 Leo,

On 2026-03-08 16:46:23+0000, Leo Yan wrote:
> 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/include/nolibc/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
> index 1958dda988954d8a604b28f5feb75ebb67ee2e14..b7f0385ccba14fdaa08aab6192acf0296b47cdbc 100644
> --- a/tools/include/nolibc/Makefile
> +++ b/tools/include/nolibc/Makefile
> @@ -105,7 +105,7 @@ headers_standalone: headers
>  	$(Q)$(MAKE) -C $(srctree) headers_install INSTALL_HDR_PATH=$(OUTPUT)sysroot
>  
>  CFLAGS_s390 := -m64
> -CFLAGS := $(CFLAGS_$(ARCH))
> +CFLAGS := $(CFLAGS_$(ARCH)) $(EXTRA_CFLAGS)

I don't think we need additional cflags in tools/include/nolibc.
The only thing this Makefile does is to test-compile some headers.

>  headers_check: headers_standalone
>  	$(Q)for header in $(filter-out crt.h std.h,$(all_files)); do \


Thomas

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

* Re: [PATCH v3 29/30] selftests/nolibc: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 29/30] selftests/nolibc: " Leo Yan
@ 2026-03-09 22:24   ` Thomas Weißschuh
  2026-03-10 16:06     ` Leo Yan
  0 siblings, 1 reply; 77+ messages in thread
From: Thomas Weißschuh @ 2026-03-09 22:24 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andrew Morton, Willy Tarreau, 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 Leo,

On 2026-03-08 16:46:34+0000, Leo Yan wrote:
> 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/testing/selftests/nolibc/Makefile.nolibc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
> index f5704193038f7da935d57e0f894970b6e29b78da..e58b2f5eb2b231bb1c194db7365fff7b4e244e5d 100644
> --- a/tools/testing/selftests/nolibc/Makefile.nolibc
> +++ b/tools/testing/selftests/nolibc/Makefile.nolibc
> @@ -252,6 +252,9 @@ endif
>  # Modify CFLAGS based on LLVM=
>  include $(srctree)/tools/scripts/Makefile.include
>  
> +# Append EXTRA_CFLAGS if it is set in tools/scripts/Makefile.include
> +CFLAGS  += $(EXTRA_CFLAGS)

Makefile.nolibc here is completely self-contained. It is not expected to
inherit any flags from the regular selftests. So I don't think this makes
sense. There is a similar, custom "CFLAGS_EXTRA" variable, which could
be aligned, but probably not as part of this series.

There is a regular 'Makefile' in this directory which *is* integrated
with the regular selftest build system. If you could make sure that
it works correctly with what you are doing, that would be great.


Thomas

> +
>  REPORT  ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
>  		/^Total number of errors:/{done++} \
>  		END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \
> 
> -- 
> 2.34.1
> 

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

* Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
  2026-03-09 16:37     ` Ian Rogers
@ 2026-03-10 11:48       ` Leo Yan
  0 siblings, 0 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-10 11:48 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Steven Rostedt, 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,
	Gabriele Monaco, Shuah Khan, Jiri Kosina, Benjamin Tissoires,
	linux-kbuild, linux-kernel, llvm, bpf, linux-perf-users

On Mon, Mar 09, 2026 at 09:37:07AM -0700, Ian Rogers wrote:
> On Mon, Mar 9, 2026 at 8:44 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > On Sun, 08 Mar 2026 16:46:29 +0000
> > Leo Yan <leo.yan@arm.com> wrote:
> >
> > > Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> > > the compiler.
> > >
> > > Signed-off-by: Leo Yan <leo.yan@arm.com>
> >
> > Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> 
> Not a problem with the change but running this patch through an AI
> agent brought up:
> 
>   Should CFLAGS be initialized with default optimization and warning flags
>   (e.g., -g -O2 -Wall)?
> 
>   Currently, latency-collector is built without these standard compilation
>   flags because they are missing from the Makefile. In other commits in this
>   series (like for libbpf and thermal), CFLAGS was explicitly initialized to
>  -g -O2 or -g -Wall when EXTRA_CFLAGS is not set.
> 
>   Additionally, should EXTRA_WARNINGS (provided by
>   tools/scripts/Makefile.include) be appended to CFLAGS here, similar to
>   how it is done for other tools?

Thanks for sharing this, Ian.

I would like to keep the scope of this series focused on appending the
-fzero-init-padding-bits=all option.  The comment above from AI is not
relevant to this purpose, I'd leave it to the project maintainer for
further refactoring.

As you suggested in other reples, I will update to append EXTRA_CFLAGS
at the last so that it can override the default values.  I will also
collect Steven's ACK tag.

If there are any concerns, please let me know.

Leo

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

* Re: [PATCH v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include
  2026-03-09 10:07     ` Leo Yan
@ 2026-03-10 12:00       ` Daniel Lezcano
  0 siblings, 0 replies; 77+ messages in thread
From: Daniel Lezcano @ 2026-03-10 12:00 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	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 Leo,

On 3/9/26 11:07, Leo Yan wrote:
> Hi Daniel,
> 
> On Mon, Mar 09, 2026 at 09:41:16AM +0100, Daniel Lezcano wrote:
> 
> [...]
> 
>> On 3/8/26 17:46, Leo Yan wrote:
>>> Initialize CFLAGS to the default value before including
>>> tools/scripts/Makefile.include.
>>>
>>> Defer appending EXTRA_CFLAGS to CFLAGS until after including
>>> Makefile.include, as it may extend EXTRA_CFLAGS in the future.
>>>
>>> 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 056d212f25cf51cd8c02260fbe2ef28dda5e4acb..1890779f1574ebd9015f3001b9bb31d4bc0ae5ce 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
>>> +
>>
>> Sorry, I don't get the comment :/
>>
>> Can you clarify the intended purpose with this change ?
> 
> Sure. Since this series sets EXTRA_CFLAGS in Makefile.include (patch 05).
> Without this patch, the init behavior of the thermal Makefile may change.
> 
> For example:
> 
>    make -C tools/thermal/lib/
> 
> Before this series, the Makefile initializes:
> 
>    CFLAGS := -g -Wall
> 
> If _only_ patch 05 is applied, EXTRA_CFLAGS is implicitly set in
> tools/scripts/Makefile.include to work around compiler bugs. The
> Makefile would initialize:
> 
>    CFLAGS := $(EXTRA_CFLAGS)
> 
> This patch preserves the original initialization of CFLAGS, but changes
> the sequence:
> 
>    CFLAGS := -g -Wall
>    CFLAGS += $(EXTRA_CFLAGS)
> 
> If $(EXTRA_CFLAGS) is set by Makefile.include, it will be appended.
> Otherwise, if $(EXTRA_CFLAGS) is empty, the behavior remains unchanged.
> 
>>   and the 'override' directive below ?
> 
> The override directive is used to override any CFLAGS set on the make
> command line.  This patch does not introduce the directive; it simply
> follows the existing style.  As you can see, the following lines
> already use the directive when appending options.

Thanks for the clarification

Acked-by: Daniel Lezcano <daniel.lezcano@kernel.org>



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

* Re: [PATCH v3 10/30] tools build: Append extra cflags for feature
  2026-03-09 17:51   ` Ian Rogers
@ 2026-03-10 14:25     ` Leo Yan
  0 siblings, 0 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-10 14:25 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

On Mon, Mar 09, 2026 at 10:51:43AM -0700, Ian Rogers wrote:
> On Sun, Mar 8, 2026 at 9:47 AM Leo Yan <leo.yan@arm.com> wrote:
> >
> > Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> > the feature build.
> >
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> > ---
> >  tools/build/feature/Makefile | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 1fbcb3ce74d2173072748a417fc63bd9a5b13888..103d8b71e7a4e8d0979242cfc95c1c0b946222b5 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -1,6 +1,8 @@
> >  # SPDX-License-Identifier: GPL-2.0
> >  include ../../scripts/Makefile.include
> >
> > +CFLAGS += $(EXTRA_CFLAGS)
> > +
> 
> Is this necessary? In Makefile.feature:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/build/Makefile.feature#n11
> The build invocation does "CFLAGS="$(EXTRA_CFLAGS)" and so the locally
> set CFLAGS appear to be ignored.

You are right.  So far, some projects (perf, latency, rtla and
verification/rv) calls feature_check with "CFLAGS=$(EXTRA_CFLAGS) ...".
I confirmed with pref build, the -fzero-init-padding-bits=all option
has been properly appended and passed to feature build:

  gcc -fzero-init-padding-bits=all -I/usr/include/python3.12 ...

As a result, it is useless for this patch.  I will drop it.

Thanks,
Leo

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

* Re: [PATCH v3 26/30] tools: verification: Append extra cflags
  2026-03-09  6:26   ` Gabriele Monaco
@ 2026-03-10 15:58     ` Leo Yan
  0 siblings, 0 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-10 15:58 UTC (permalink / raw)
  To: Gabriele Monaco
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	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, Shuah Khan, Jiri Kosina, Benjamin Tissoires,
	linux-kbuild, linux-kernel, llvm, bpf, linux-perf-users

On Mon, Mar 09, 2026 at 07:26:16AM +0100, Gabriele Monaco wrote:
> On Sun, 2026-03-08 at 16:46 +0000, Leo Yan wrote:
> > Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> > the compiler.
> > 
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> 
> Thanks, for the patch, however I don't think this is necessary for RV as
> EXTRA_CFLAGS are already appended to CFLAGS elsewhere [1].
> 
> Makefile.rv is included after the various Makefile.include, so I presume that's
> good to go for the new flags you're appending in this series.
> I did a quick check and I see -fzero-init-padding-bits=all by just adding 05/30
> of this series.
> 
> [1] -
> https://elixir.bootlin.com/linux/v6.19.3/source/tools/verification/rv/Makefile.rv#L29

Thanks!  I will drop this one in next spin.

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

* Re: [PATCH v3 29/30] selftests/nolibc: Append extra cflags
  2026-03-09 22:24   ` Thomas Weißschuh
@ 2026-03-10 16:06     ` Leo Yan
  0 siblings, 0 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-10 16:06 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
	Kees Cook, Quentin Monnet, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Adrian Hunter, Masami Hiramatsu, William Breathitt Gray,
	Barry Song, Qinxin Xia, Bartosz Golaszewski, Kent Gibson,
	K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andrew Morton, Willy Tarreau, 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 Mon, Mar 09, 2026 at 11:24:58PM +0100, Thomas Weißschuh wrote:
> Hi Leo,
> 
> On 2026-03-08 16:46:34+0000, Leo Yan wrote:
> > 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/testing/selftests/nolibc/Makefile.nolibc | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
> > index f5704193038f7da935d57e0f894970b6e29b78da..e58b2f5eb2b231bb1c194db7365fff7b4e244e5d 100644
> > --- a/tools/testing/selftests/nolibc/Makefile.nolibc
> > +++ b/tools/testing/selftests/nolibc/Makefile.nolibc
> > @@ -252,6 +252,9 @@ endif
> >  # Modify CFLAGS based on LLVM=
> >  include $(srctree)/tools/scripts/Makefile.include
> >  
> > +# Append EXTRA_CFLAGS if it is set in tools/scripts/Makefile.include
> > +CFLAGS  += $(EXTRA_CFLAGS)
> 
> Makefile.nolibc here is completely self-contained. It is not expected to
> inherit any flags from the regular selftests. So I don't think this makes
> sense. There is a similar, custom "CFLAGS_EXTRA" variable, which could
> be aligned, but probably not as part of this series.
> 
> There is a regular 'Makefile' in this directory which *is* integrated
> with the regular selftest build system. If you could make sure that
> it works correctly with what you are doing, that would be great.

Sure, I will update the regular Makefile.

As you suggested, I also will drop patch 18 in new version.

Thanks for suggestions!

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

* Re: [PATCH v3 27/30] selftests/bpf: Append extra cflags
  2026-03-08 16:46 ` [PATCH v3 27/30] selftests/bpf: " Leo Yan
  2026-03-09 18:05   ` Ian Rogers
@ 2026-03-10 17:50   ` Leo Yan
  1 sibling, 0 replies; 77+ messages in thread
From: Leo Yan @ 2026-03-10 17:50 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

On Sun, Mar 08, 2026 at 04:46:32PM +0000, Leo Yan wrote:
> Append EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to
> the compiler.
> 
> Signed-off-by: Leo Yan <leo.yan@arm.com>

FWIW, this patch causes bpf selftest build failure and was reported in:

  https://github.com/kernel-patches/bpf/actions/runs/22825654003

The Makefile reuses CFLAGS for clang to build urandom_read, which may
cause GCC specific flags to feed to clang and causes errors.

The updated patch will introduce a new variable URANDOM_READ_CFLAGS,
without appending EXTRA_CFLAGS, this can effectively avoid incompatible
options.

Thanks,
Leo

> ---
>  tools/testing/selftests/bpf/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 72a9ba41f95ebb825d25799c07ba3f0311243e45..29dfcdbe98c781b53f1e87dcebecf2027bafcd5d 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -49,6 +49,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
>  srctree := $(patsubst %/,%,$(dir $(srctree)))
>  endif
>  
> +CFLAGS += $(EXTRA_CFLAGS)
>  CFLAGS += -g $(OPT_FLAGS) -rdynamic -std=gnu11				\
>  	  -Wall -Werror -fno-omit-frame-pointer				\
>  	  -Wno-unused-but-set-variable					\
> 
> -- 
> 2.34.1
> 

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

end of thread, other threads:[~2026-03-10 17:50 UTC | newest]

Thread overview: 77+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08 16:46 [PATCH v3 00/30] tools build: Append -fzero-init-padding-bits=all option Leo Yan
2026-03-08 16:46 ` [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS Leo Yan
2026-03-09 10:17   ` Quentin Monnet
2026-03-09 17:40   ` Ian Rogers
2026-03-09 17:51     ` Quentin Monnet
2026-03-08 16:46 ` [PATCH v3 02/30] libbpf: Initialize CFLAGS before including Makefile.include Leo Yan
2026-03-09 17:03   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 03/30] tools: lib: thermal: " Leo Yan
2026-03-09 15:10   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 04/30] tools/thermal: " Leo Yan
2026-03-09  8:41   ` Daniel Lezcano
2026-03-09 10:07     ` Leo Yan
2026-03-10 12:00       ` Daniel Lezcano
2026-03-08 16:46 ` [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags Leo Yan
2026-03-09 10:17   ` Quentin Monnet
2026-03-09 17:17   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 06/30] bpftool: Append extra host flags Leo Yan
2026-03-09 10:17   ` Quentin Monnet
2026-03-08 16:46 ` [PATCH v3 07/30] perf build: " Leo Yan
2026-03-08 16:46 ` [PATCH v3 08/30] tools/bpf: build: Append extra cflags Leo Yan
2026-03-09 17:42   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 09/30] tools build: Append extra host cflags Leo Yan
2026-03-08 16:46 ` [PATCH v3 10/30] tools build: Append extra cflags for feature Leo Yan
2026-03-09 17:51   ` Ian Rogers
2026-03-10 14:25     ` Leo Yan
2026-03-08 16:46 ` [PATCH v3 11/30] tools: bootconfig: Append extra cflags Leo Yan
2026-03-09 12:22   ` Masami Hiramatsu
2026-03-09 17:53   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 12/30] tools: counter: " Leo Yan
2026-03-09 17:55   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 13/30] tools: dma: " Leo Yan
2026-03-09 12:08   ` Qinxin Xia
2026-03-09 17:56   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 14/30] tools: gpio: " Leo Yan
2026-03-09  8:54   ` Bartosz Golaszewski
2026-03-09 17:57   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 15/30] tools: hv: " Leo Yan
2026-03-08 20:28   ` [EXTERNAL] " Haiyang Zhang
2026-03-09 17:58   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 16/30] tools: iio: " Leo Yan
2026-03-09 17:58   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 17/30] tools: mm: " Leo Yan
2026-03-09 17:59   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 18/30] tools: nolibc: " Leo Yan
2026-03-09 22:20   ` Thomas Weißschuh
2026-03-08 16:46 ` [PATCH v3 19/30] tools: objtool: Append extra host cflags Leo Yan
2026-03-09 20:19   ` Josh Poimboeuf
2026-03-08 16:46 ` [PATCH v3 20/30] tools: power: acpi: Append extra cflags Leo Yan
2026-03-09 18:01   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 21/30] tools: power: x86/intel-speed-select: " Leo Yan
2026-03-09 15:59   ` srinivas pandruvada
2026-03-09 18:02   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 22/30] tools: sched_ext: " Leo Yan
2026-03-09 18:07   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 23/30] tools: spi: " Leo Yan
2026-03-08 23:21   ` Mark Brown
2026-03-09 18:03   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 24/30] tools: tracing: " Leo Yan
2026-03-09 15:44   ` Steven Rostedt
2026-03-09 16:37     ` Ian Rogers
2026-03-10 11:48       ` Leo Yan
2026-03-08 16:46 ` [PATCH v3 25/30] tools: usb: " Leo Yan
2026-03-09 18:04   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 26/30] tools: verification: " Leo Yan
2026-03-09  6:26   ` Gabriele Monaco
2026-03-10 15:58     ` Leo Yan
2026-03-08 16:46 ` [PATCH v3 27/30] selftests/bpf: " Leo Yan
2026-03-09 18:05   ` Ian Rogers
2026-03-10 17:50   ` Leo Yan
2026-03-08 16:46 ` [PATCH v3 28/30] selftests/hid: " Leo Yan
2026-03-09 18:06   ` Ian Rogers
2026-03-08 16:46 ` [PATCH v3 29/30] selftests/nolibc: " Leo Yan
2026-03-09 22:24   ` Thomas Weißschuh
2026-03-10 16:06     ` Leo Yan
2026-03-08 16:46 ` [PATCH v3 30/30] selftests/sched_ext: " Leo Yan
2026-03-09 12:45   ` Andrea Righi
2026-03-09 18:02   ` Ian Rogers

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