tools build: Append -fzero-init-padding-bits=all option
Subsystems (24)
v3 cover tools build: Append -fzero-init-padding-bits=all option
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=1Test 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
---
Changes in v3:
- Extended to support cross compilation (Quentin).
- Link to v2: https://lore.kernel.org/r/[email protected]
---
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,
Signature · 1 line
Leo Yan <[email protected]>
PATCH v3 1/30 bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
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.
--- tools/bpf/bpftool/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/bpf/bpftool/Makefile +6 -2
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
2026-03-08 16:46 UTC+0000 ~ Leo Yan <[email protected]>
Quoted 7 lines
Prepare for future changes where
EXTRA_CFLAGSmay include flags not applicable to the host compiler.Move the
HOST_CFLAGSassignment before appendingEXTRA_CFLAGSto CFLAGS so thatHOST_CFLAGSdoes not inherit flags fromEXTRA_CFLAGS.Signed-off-by Leo Yan <[email protected]>
Ian Rogers
reviewerRe: [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
In reply to Leo YanQuoted 30 lines · Leo Yan
Prepare for future changes where
EXTRA_CFLAGSmay include flags not applicable to the host compiler.Move the
HOST_CFLAGSassignment before appendingEXTRA_CFLAGSto CFLAGS so thatHOST_CFLAGSdoes not inherit flags fromEXTRA_CFLAGS.Signed-off-by Leo Yan <[email protected]>--- tools/bpf/bpftool/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/bpf/bpftool/Makefile +6
-0@@ -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
tools/bpf/bpftool/Makefile ifneq ($(EXTRA_LDFLAGS),) · line 97
Quoted 6 lines
tools/bpf/bpftool/Makefile +0
-2@@ -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
Quoted 5 lines
tools/bpf/bpftool/Makefile +0
-1INSTALL ?= install --2.34.1
Quentin Monnet
maintainerRe: [PATCH v3 01/30] bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
2026-03-09 10:40 UTC-0700 ~ Ian Rogers <[email protected]>
Quoted 34 lines · Leo Yan
Quoted 33 lines
Prepare for future changes where
EXTRA_CFLAGSmay include flags not applicable to the host compiler.Move the
HOST_CFLAGSassignment before appendingEXTRA_CFLAGSto CFLAGS so thatHOST_CFLAGSdoes not inherit flags fromEXTRA_CFLAGS.Signed-off-by Leo Yan <[email protected]>--- tools/bpf/bpftool/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/bpf/bpftool/Makefile +6
-0@@ -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
Quoted 12 lines
tools/bpf/bpftool/Makefile ifneq ($(EXTRA_LDFLAGS),) · line 97
Quoted 3 lines
tools/bpf/bpftool/Makefile +0
-2-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 hostbpftoolwhen cross-compiling (perf's build should use the hostbpftool). If theHOST_LDFLAGSwere set to LDFLAGS beforeEXTRA_LDFLAGSare 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
PATCH v3 2/30 libbpf: Initialize CFLAGS before including Makefile.include
In reply to Leo YanInitialize 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.
--- tools/lib/bpf/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
tools/lib/bpf/Makefile +9 -7
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 02/30] libbpf: Initialize CFLAGS before including Makefile.include
Quoted 37 lines · Leo Yan
Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.Defer appending
EXTRA_CFLAGSto CFLAGS until after including Makefile.include, as it may extendEXTRA_CFLAGSin the future.Signed-off-by Leo Yan <[email protected]>--- tools/lib/bpf/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)tools/lib/bpf/Makefile +8
-2@@ -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
tools/lib/bpf/Makefile LIB_TARGET = libbpf.a libbpf.so.$(LIBBPF_VERSION) · line 85
Quoted 10 lines
tools/lib/bpf/Makefile +1
-5- 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
Quoted 3 lines
--
2.34.1
PATCH v3 3/30 tools: lib: thermal: Initialize CFLAGS before including Makefile.include
In reply to Leo YanInitialize 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.
--- tools/lib/thermal/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
tools/lib/thermal/Makefile +9 -7
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 03/30] tools: lib: thermal: Initialize CFLAGS before including Makefile.include
Quoted 46 lines · Leo Yan
Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.Defer appending
EXTRA_CFLAGSto CFLAGS until after including Makefile.include, as it may extendEXTRA_CFLAGSin the future.Signed-off-by Leo Yan <[email protected]>--- tools/lib/thermal/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)tools/lib/thermal/Makefile +8
-7@@ -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
tools/lib/thermal/Makefile INCLUDES = \ · line 67
Quoted 7 lines
tools/lib/thermal/Makefile +1
-0@@ -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
Quoted 3 lines
--
2.34.1
PATCH v3 4/30 tools/thermal: Initialize CFLAGS before including Makefile.include
In reply to Leo YanInitialize 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.
--- tools/thermal/lib/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
tools/thermal/lib/Makefile +9 -7
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include
Hi Leo,
Quoted 17 lines · Leo Yan
Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.Defer appending
EXTRA_CFLAGSto CFLAGS until after including Makefile.include, as it may extendEXTRA_CFLAGSin the future.Signed-off-by Leo Yan <[email protected]>--- tools/thermal/lib/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)tools/thermal/lib/Makefile +0
-0@@ -23,6 +23,14 @@ INSTALL = install DESTDIR ?=
tools/thermal/lib/Makefile INSTALL = install · line 33
Quoted 10 lines
tools/thermal/lib/Makefile +8
-0DESTDIR_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 ?
Quoted 26 lines
tools/thermal/lib/Makefile +1
-7include $(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
Re: [PATCH v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include
Hi Daniel,
On Mon, Mar 09, 2026 at 09:41:16AM +0100, Daniel Lezcano wrote:
[...]
Quoted 30 lines · Leo Yan
Quoted 16 lines
Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.Defer appending
EXTRA_CFLAGSto CFLAGS until after including Makefile.include, as it may extendEXTRA_CFLAGSin the future.Signed-off-by Leo Yan <[email protected]>--- tools/thermal/lib/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)tools/thermal/lib/Makefile +0
-0tools/thermal/lib/Makefile INSTALL = install · line 32
Quoted 10 lines
tools/thermal/lib/Makefile +8
-0@@ -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 :/
Quoted 1 line
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.
Quoted 1 line
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
Quoted 24 lines
Quoted 23 lines
tools/thermal/lib/Makefile +1
-7include $(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
Daniel Lezcano
Acked-byRe: [PATCH v3 04/30] tools/thermal: Initialize CFLAGS before including Makefile.include
Hi Leo,
Quoted 64 lines · Leo Yan
Hi Daniel,
On Mon, Mar 09, 2026 at 09:41:16AM +0100, Daniel Lezcano wrote:
[...]
Quoted 30 lines · Leo Yan
Quoted 16 lines
Initialize CFLAGS to the default value before including
tools/scripts/Makefile.include.Defer appending
EXTRA_CFLAGSto CFLAGS until after including Makefile.include, as it may extendEXTRA_CFLAGSin the future.Signed-off-by Leo Yan <[email protected]>--- tools/thermal/lib/Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)tools/thermal/lib/Makefile +0
-0tools/thermal/lib/Makefile INSTALL = install · line 32
Quoted 10 lines
tools/thermal/lib/Makefile +8
-0@@ -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 :/
Quoted 1 line
Can you clarify the intended purpose with this change ?
Sure. Since this series sets
EXTRA_CFLAGSin Makefile.include (patch 05). Without this patch, the init behavior of the thermalMakefilemay change.For example:
make -C
tools/thermal/lib/Before this series, the
Makefileinitializes:CFLAGS := -g -Wall
If _only_ patch 05 is applied,
EXTRA_CFLAGSis implicitly set intools/scripts/Makefile.includeto work around compiler bugs. TheMakefilewould 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.
Quoted 6 lines
Quoted 1 line
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
PATCH v3 5/30 tools build: Append -fzero-init-padding-bits=all to extra cflags
In reply to Leo YanGCC-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
--- tools/scripts/Makefile.include | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
tools/scripts/Makefile.include +28 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags
2026-03-08 16:46 UTC+0000 ~ Leo Yan <[email protected]>
Quoted 17 lines
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.
Quoted 8 lines
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_CFLAGSandHOST_EXTRACFLAGSrespectively.[1] https://gcc.gnu.org/gcc-15/changes.html
Signed-off-by Leo Yan <[email protected]>
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!
Ian Rogers
reviewerRe: [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags
In reply to Leo YanQuoted 55 lines · 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_CFLAGSandHOST_EXTRACFLAGSrespectively.[1] https://gcc.gnu.org/gcc-15/changes.html
Signed-off-by Leo Yan <[email protected]>--- tools/scripts/Makefile.include | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)tools/scripts/Makefile.include +17
-0@@ -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
tools/scripts/Makefile.include else · line 166
Quoted 10 lines
tools/scripts/Makefile.include +10
-0+# 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
Quoted 8 lines
tools/scripts/Makefile.include +1
-1+ ifneq ($(findstring $(MAKEFLAGS), w),w) PRINT_DIR = --no-print-directory else --2.34.1
PATCH v3 6/30 bpftool: Append extra host flags
In reply to Leo YanAppend HOST_EXTRACFLAGS to HOST_CFLAGS so that additional flags can be applied to the host compiler.
--- tools/bpf/bpftool/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/bpf/bpftool/Makefile +1 -0
@@ -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)
Signature · 1 line
2.34.1
Re: [PATCH v3 06/30] bpftool: Append extra host flags
2026-03-08 16:46 UTC+0000 ~ Leo Yan <[email protected]>
Quoted 4 lines
Append
HOST_EXTRACFLAGStoHOST_CFLAGSso that additional flags can be applied to the host compiler.Signed-off-by Leo Yan <[email protected]>
PATCH v3 7/30 perf build: Append extra host flags
In reply to Leo YanAppend HOST_EXTRACFLAGS to HOST_CFLAGS so that additional flags can be applied to the host compiler.
--- tools/perf/Makefile.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
@@ -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_*().
Signature · 1 line
2.34.1
PATCH v3 8/30 tools/bpf: build: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/bpf/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/bpf/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 08/30] tools/bpf: build: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/bpf/Makefile | 1 + 1 file changed, 1 insertion(+)tools/bpf/Makefile +0
-0
tools/bpf/Makefile YACC = bison · line 14
Quoted 7 lines
tools/bpf/Makefile +1
-0@@ -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
Quoted 3 lines
--
2.34.1
PATCH v3 9/30 tools build: Append extra host cflags
In reply to Leo YanAppend HOST_EXTRACFLAGS to HOSTCFLAGS so that additional flags can be applied to the host compiler.
--- tools/build/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/build/Makefile +4 -2
@@ -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)
Signature · 1 line
2.34.1
PATCH v3 10/30 tools build: Append extra cflags for feature
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the feature build.
--- tools/build/feature/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/build/feature/Makefile +2 -0
@@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 include ../../scripts/Makefile.include +CFLAGS += $(EXTRA_CFLAGS) + FILES= \ test-all.bin \ test-backtrace.bin \
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 10/30] tools build: Append extra cflags for feature
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the feature build.Signed-off-by Leo Yan <[email protected]>--- tools/build/feature/Makefile | 2 ++ 1 file changed, 2 insertions(+)tools/build/feature/Makefile +0
-0
tools/build/feature/Makefile line 5
Quoted 5 lines
tools/build/feature/Makefile +2
-0@@ -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
Quoted 7 lines
tools/build/feature/Makefile +0
-1FILES= \ test-all.bin \ test-backtrace.bin \ --2.34.1
Re: [PATCH v3 10/30] tools build: Append extra cflags for feature
Quoted 18 lines · Ian Rogers
Quoted 17 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the feature build.Signed-off-by Leo Yan <[email protected]>--- tools/build/feature/Makefile | 2 ++ 1 file changed, 2 insertions(+)tools/build/feature/Makefile +0
-0@@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 include ../../scripts/Makefile.include
Quoted 7 lines
tools/build/feature/Makefile line 5
Quoted 2 lines
tools/build/feature/Makefile +2
-0+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
PATCH v3 11/30 tools: bootconfig: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/bootconfig/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/bootconfig/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 11/30] tools: bootconfig: Append extra cflags
Quoted 4 lines · On Sun, 08 Mar 2026 16:46:16 +0000 Leo Yan <[email protected]> wrote:
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>
This looks good to me.
Thanks,
Quoted 20 lines
--- tools/bootconfig/Makefile | 1 + 1 file changed, 1 insertion(+)tools/bootconfig/Makefile +1
-0@@ -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 := bootconfigSignature · 2 lines
-- 2.34.1
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Ian Rogers
reviewerRe: [PATCH v3 11/30] tools: bootconfig: Append extra cflags
In reply to Leo YanQuoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/bootconfig/Makefile | 1 + 1 file changed, 1 insertion(+)tools/bootconfig/Makefile +0
-0
tools/bootconfig/Makefile srctree := $(patsubst %/,%,$(dir $(srctree))) · line 14
Quoted 5 lines
tools/bootconfig/Makefile +1
-0@@ -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
Quoted 5 lines
tools/bootconfig/Makefile +0
-1ALL_TARGETS := bootconfig --2.34.1
PATCH v3 12/30 tools: counter: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/counter/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/counter/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 12/30] tools: counter: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/counter/Makefile | 1 + 1 file changed, 1 insertion(+)tools/counter/Makefile +0
-0
tools/counter/Makefile endif · line 17
Quoted 6 lines
tools/counter/Makefile +1
-0@@ -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
Quoted 4 lines
tools/counter/Makefile +0
-1--2.34.1
PATCH v3 13/30 tools: dma: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/dma/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/dma/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 13/30] tools: dma: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/dma/Makefile | 1 + 1 file changed, 1 insertion(+)tools/dma/Makefile +0
-0
tools/dma/Makefile endif · line 22
Quoted 7 lines
tools/dma/Makefile +1
-0@@ -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
Signature · 2 lines
Thanks, Qinxin
Ian Rogers
reviewerRe: [PATCH v3 13/30] tools: dma: Append extra cflags
In reply to Leo YanQuoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/dma/Makefile | 1 + 1 file changed, 1 insertion(+)tools/dma/Makefile +0
-0
tools/dma/Makefile endif · line 20
Quoted 5 lines
tools/dma/Makefile +1
-0@@ -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
Quoted 5 lines
tools/dma/Makefile +0
-1ALL_TARGETS := dma_map_benchmark --2.34.1
PATCH v3 14/30 tools: gpio: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/gpio/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/gpio/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 14/30] tools: gpio: Append extra cflags
Quoted 22 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/gpio/Makefile | 1 + 1 file changed, 1 insertion(+)tools/gpio/Makefile +1
-1@@ -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 --
Quoted 3 lines
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 14/30] tools: gpio: Append extra cflags
In reply to Leo YanQuoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/gpio/Makefile | 1 + 1 file changed, 1 insertion(+)tools/gpio/Makefile +0
-0
tools/gpio/Makefile endif · line 20
Quoted 5 lines
tools/gpio/Makefile +1
-0@@ -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
Quoted 5 lines
tools/gpio/Makefile +0
-1ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon gpio-watch --2.34.1
PATCH v3 15/30 tools: hv: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/hv/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/hv/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
RE: [EXTERNAL] [PATCH v3 15/30] tools: hv: Append extra cflags
Quoted 63 lines
-----Original Message-----
From: Leo Yan <[email protected]>
Sent: Sunday, March 8, 2026 12:46 PM
To: Arnaldo Carvalho de Melo <[email protected]>; Ian Rogers <[email protected]>; Namhyung Kim <[email protected]>; James Clark <[email protected]>; Kees Cook <[email protected]>; Quentin Monnet <[email protected]>; Nathan Chancellor <[email protected]>; Nicolas Schier <[email protected]>; Nick Desaulniers <[email protected]>; Bill Wendling <[email protected]>; Justin Stitt <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Andrii Nakryiko <[email protected]>; Martin KaFai Lau <[email protected]>; Eduard Zingerman <[email protected]>; Song Liu <[email protected]>; Yonghong Song <[email protected]>; John Fastabend <[email protected]>; KP Singh <[email protected]>; Stanislav Fomichev <[email protected]>; Hao Luo <[email protected]>; Jiri Olsa <[email protected]>; Rafael J. Wysocki <[email protected]>; Daniel Lezcano <[email protected]>; Zhang Rui <[email protected]>; Lukasz Luba <[email protected]>; Peter Zijlstra <[email protected]>; Ingo Molnar <[email protected]>; Mark Rutland <[email protected]>; Alexander Shishkin <[email protected]>; Adrian Hunter <[email protected]>; Masami Hiramatsu <[email protected]>; William Breathitt Gray <[email protected]>; Barry Song <[email protected]>; Qinxin Xia <[email protected]>; Bartosz Golaszewski <[email protected]>; Kent Gibson <[email protected]>; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Wei Liu <[email protected]>; Dexuan Cui <[email protected]>; Long Li <[email protected]>; Jonathan Cameron <[email protected]>; David Lechner <[email protected]>; Nuno Sá <[email protected]>; Andy Shevchenko <[email protected]>; Andrew Morton <[email protected]>; Willy Tarreau <[email protected]>; Thomas Weißschuh <[email protected]>; Josh Poimboeuf <[email protected]>; Robert Moore <[email protected]>; Len Brown <[email protected]>; Srinivas Pandruvada <[email protected]>; Tejun Heo <[email protected]>; David Vernet <[email protected]>; Andrea Righi <[email protected]>; Changwoo Min <[email protected]>; Mark Brown <[email protected]>; Steven Rostedt <[email protected]>; Gabriele Monaco <[email protected]>; Shuah Khan <[email protected]>; Jiri Kosina <[email protected]>; Benjamin Tissoires <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux-perf- [email protected]; Leo Yan <[email protected]>
Subject: [EXTERNAL] [PATCH v3 15/30] tools: hv: Append extra cflags[Some people who received this message don't often get email from [email protected]. Learn why this is important at
https://aka.ms/LearnAboutSenderIdentification ]Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/hv/Makefile | 1 + 1 file changed, 1 insertion(+)tools/hv/Makefile +0
-0index
34ffcec264ab0fdf7075d25456ef012cb866796b..e39c16325b451ee7c2ddc581cc4d168915472ed6100644
tools/hv/Makefile endif · line 21
Quoted 6 lines
tools/hv/Makefile +1
-0@@ -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
Ian Rogers
reviewerRe: [PATCH v3 15/30] tools: hv: Append extra cflags
In reply to Leo YanQuoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/hv/Makefile | 1 + 1 file changed, 1 insertion(+)tools/hv/Makefile +0
-0
tools/hv/Makefile endif · line 21
Quoted 6 lines
tools/hv/Makefile +1
-0@@ -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
Quoted 4 lines
tools/hv/Makefile +0
-1--2.34.1
PATCH v3 16/30 tools: iio: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/iio/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/iio/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 16/30] tools: iio: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/iio/Makefile | 1 + 1 file changed, 1 insertion(+)tools/iio/Makefile +0
-0
tools/iio/Makefile endif · line 16
Quoted 5 lines
tools/iio/Makefile +1
-0@@ -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
Quoted 5 lines
tools/iio/Makefile +0
-1ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer --2.34.1
PATCH v3 17/30 tools: mm: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/mm/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/mm/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 17/30] tools: mm: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/mm/Makefile | 1 + 1 file changed, 1 insertion(+)tools/mm/Makefile +0
-0
tools/mm/Makefile INSTALL_TARGETS = $(BUILD_TARGETS) thpmaps · line 13
Quoted 5 lines
tools/mm/Makefile +1
-0@@ -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
Quoted 6 lines
tools/mm/Makefile +0
-1LDFLAGS += $(LIBS) -pthread --2.34.1
PATCH v3 18/30 tools: nolibc: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/include/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/include/nolibc/Makefile +1 -1
@@ -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 \
Signature · 1 line
2.34.1
Thomas Weißschuh
maintainerRe: [PATCH v3 18/30] tools: nolibc: Append extra cflags
Hi Leo,
Quoted 13 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/include/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/include/nolibc/Makefile +0
-0
tools/include/nolibc/Makefile headers_standalone: headers · line 108
Quoted 5 lines
tools/include/nolibc/Makefile +1
-1@@ -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.
tools/include/nolibc/Makefile headers_standalone: headers · line 111
Quoted 2 lines
tools/include/nolibc/Makefile +0
-0headers_check: headers_standalone $(Q)for header in $(filter-out crt.h std.h,$(all_files)); do \
Thomas
PATCH v3 19/30 tools: objtool: Append extra host cflags
In reply to Leo YanAppend HOST_EXTRACFLAGS to HOSTCFLAGS so that additional flags can be applied to the host compiler.
--- tools/objtool/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/objtool/Makefile +2 -0
@@ -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)
Signature · 1 line
2.34.1
Re: [PATCH v3 19/30] tools: objtool: Append extra host cflags
Quoted 4 lines · Leo Yan
Append
HOST_EXTRACFLAGSto HOSTCFLAGS so that additional flags can be applied to the host compiler.Signed-off-by Leo Yan <[email protected]>
Thanks!
Signature · 1 line
Josh
PATCH v3 20/30 tools: power: acpi: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/power/acpi/Makefile.config | 1 + 1 file changed, 1 insertion(+)
tools/power/acpi/Makefile.config +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 20/30] tools: power: acpi: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/power/acpi/Makefile.config | 1 + 1 file changed, 1 insertion(+)tools/power/acpi/Makefile.config +0
-0
tools/power/acpi/Makefile.config WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) · line 72
Quoted 6 lines
tools/power/acpi/Makefile.config +1
-0@@ -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
Quoted 5 lines
tools/power/acpi/Makefile.config +0
-1MKDIR = mkdir --2.34.1
PATCH v3 21/30 tools: power: x86/intel-speed-select: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/power/x86/intel-speed-select/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/power/x86/intel-speed-select/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 21/30] tools: power: x86/intel-speed-select: Append extra cflags
Quoted 5 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to
the compiler.Signed-off-by Leo Yan <[email protected]>
Quoted 20 lines
---
tools/power/x86/intel-speed-select/Makefile | 1 +1 file changed, 1 insertion(+)tools/power/x86/intel-speed-select/Makefile +0
-0index
6b299aae2ded89c3a70a3649996e258b98001ee7..61d6e81f3cf1d6427addb4f31c1369ac663ba3d6100644tools/power/x86/intel-speed-select/Makefile +0
-0@@ -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
Ian Rogers
reviewerRe: [PATCH v3 21/30] tools: power: x86/intel-speed-select: Append extra cflags
In reply to Leo YanQuoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/power/x86/intel-speed-select/Makefile | 1 + 1 file changed, 1 insertion(+)tools/power/x86/intel-speed-select/Makefile +0
-0
tools/power/x86/intel-speed-select/Makefile ifeq ($(NL3_CFLAGS),) · line 23
Quoted 5 lines
tools/power/x86/intel-speed-select/Makefile +1
-0@@ -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
Quoted 6 lines
tools/power/x86/intel-speed-select/Makefile +0
-1override LDFLAGS += -lnl-genl-3 -lnl-3 --2.34.1
PATCH v3 22/30 tools: sched_ext: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/sched_ext/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/sched_ext/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 22/30] tools: sched_ext: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/sched_ext/Makefile | 1 + 1 file changed, 1 insertion(+)tools/sched_ext/Makefile +0
-0
tools/sched_ext/Makefile ifneq ($(wildcard $(GENHDR)),) · line 95
Quoted 7 lines
tools/sched_ext/Makefile +1
-0@@ -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
Quoted 3 lines
--
2.34.1
PATCH v3 23/30 tools: spi: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/spi/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/spi/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Re: [PATCH v3 23/30] tools: spi: Append extra cflags
Quoted 2 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.
Ian Rogers
reviewerRe: [PATCH v3 23/30] tools: spi: Append extra cflags
In reply to Leo YanQuoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/spi/Makefile | 1 + 1 file changed, 1 insertion(+)tools/spi/Makefile +0
-0
tools/spi/Makefile endif · line 16
Quoted 5 lines
tools/spi/Makefile +1
-0@@ -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
Quoted 5 lines
tools/spi/Makefile +0
-1ALL_TARGETS := spidev_test spidev_fdx --2.34.1
PATCH v3 24/30 tools: tracing: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/tracing/latency/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/tracing/latency/Makefile +1 -0
@@ -56,6 +56,7 @@ ifeq ($(config),1) include Makefile.config endif +CFLAGS += $(EXTRA_CFLAGS) CFLAGS += $(INCLUDES) $(LIB_INCLUDES) export CFLAGS OUTPUT srctree
Signature · 1 line
2.34.1
Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
Quoted 4 lines · On Sun, 08 Mar 2026 16:46:29 +0000 Leo Yan <[email protected]> wrote:
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>
-- Steve
Ian Rogers
reviewerRe: [PATCH v3 24/30] tools: tracing: Append extra cflags
Quoted 10 lines · Steven Rostedt
Quoted 4 lines · On Sun, 08 Mar 2026 16:46:29 +0000 Leo Yan <[email protected]> wrote:
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>
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
Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
Quoted 18 lines · Ian Rogers
Quoted 10 lines · Steven Rostedt
Quoted 4 lines · On Sun, 08 Mar 2026 16:46:29 +0000 Leo Yan <[email protected]> wrote:
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>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)?
Quoted 8 lines
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 whenEXTRA_CFLAGSis not set.Additionally, should
EXTRA_WARNINGS(provided bytools/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
PATCH v3 25/30 tools: usb: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/usb/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/usb/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 25/30] tools: usb: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/usb/Makefile | 1 + 1 file changed, 1 insertion(+)tools/usb/Makefile +0
-0
tools/usb/Makefile endif · line 17
Quoted 5 lines
tools/usb/Makefile +1
-0@@ -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
Quoted 6 lines
tools/usb/Makefile +0
-1override LDFLAGS += -lpthread --2.34.1
PATCH v3 26/30 tools: verification: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/verification/rv/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/verification/rv/Makefile +1 -0
@@ -55,6 +55,7 @@ ifeq ($(config),1) include Makefile.config endif +CFLAGS += $(EXTRA_CFLAGS) CFLAGS += $(INCLUDES) $(LIB_INCLUDES) export CFLAGS OUTPUT srctree
Signature · 1 line
2.34.1
Gabriele Monaco
maintainerRe: [PATCH v3 26/30] tools: verification: Append extra cflags
Quoted 4 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>
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
Quoted 18 lines
---
tools/verification/rv/Makefile | 1 +1 file changed, 1 insertion(+)tools/verification/rv/Makefile +0
-0index
5b898360ba4818b12e8a16c27bd88c75d0076fb9..2882f0e93dca03b31d790b42d2ee3d8f73cc5c8b 100644tools/verification/rv/Makefile +0
-0@@ -55,6 +55,7 @@ ifeq ($(config),1)include Makefile.config
endif
+CFLAGS += $(EXTRA_CFLAGS)
CFLAGS += $(INCLUDES) $(LIB_INCLUDES)
export CFLAGS OUTPUT srctree
Re: [PATCH v3 26/30] tools: verification: Append extra cflags
Quoted 9 lines · Gabriele Monaco
Quoted 4 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>Thanks, for the patch, however I don't think this is necessary for RV as
EXTRA_CFLAGSare already appended to CFLAGS elsewhere [1].
Quoted 7 lines
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.
PATCH v3 27/30 selftests/bpf: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/testing/selftests/bpf/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/Makefile +1 -0
@@ -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 \
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 27/30] selftests/bpf: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/testing/selftests/bpf/Makefile | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/bpf/Makefile +0
-0
tools/testing/selftests/bpf/Makefile srctree := $(patsubst %/,%,$(dir $(srctree))) · line 55
Quoted 7 lines
tools/testing/selftests/bpf/Makefile +1
-0@@ -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
Quoted 3 lines
--
2.34.1
Re: [PATCH v3 27/30] selftests/bpf: Append extra cflags
In reply to Leo YanQuoted 4 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>
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
Quoted 20 lines
--- tools/testing/selftests/bpf/Makefile | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/bpf/Makefile +1
-0@@ -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 \Signature · 2 lines
-- 2.34.1
PATCH v3 28/30 selftests/hid: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/testing/selftests/hid/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/hid/Makefile +1 -0
@@ -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
Signature · 1 line
2.34.1
Ian Rogers
reviewerRe: [PATCH v3 28/30] selftests/hid: Append extra cflags
Quoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/testing/selftests/hid/Makefile | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/hid/Makefile +0
-0
tools/testing/selftests/hid/Makefile CXX ?= $(CROSS_COMPILE)g++ · line 29
Quoted 6 lines
tools/testing/selftests/hid/Makefile +1
-0@@ -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
Quoted 4 lines
tools/testing/selftests/hid/Makefile +0
-1--2.34.1
PATCH v3 29/30 selftests/nolibc: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/testing/selftests/nolibc/Makefile.nolibc | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/nolibc/Makefile.nolibc +3 -0
@@ -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); \
Signature · 1 line
2.34.1
Thomas Weißschuh
maintainerRe: [PATCH v3 29/30] selftests/nolibc: Append extra cflags
Hi Leo,
Quoted 13 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/testing/selftests/nolibc/Makefile.nolibc | 3 +++ 1 file changed, 3 insertions(+)tools/testing/selftests/nolibc/Makefile.nolibc +0
-0
tools/testing/selftests/nolibc/Makefile.nolibc endif · line 256
Quoted 5 lines
tools/testing/selftests/nolibc/Makefile.nolibc +2
-0@@ -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
Quoted 8 lines
tools/testing/selftests/nolibc/Makefile.nolibc +1
-0+ 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); \Signature · 2 lines
-- 2.34.1
Re: [PATCH v3 29/30] selftests/nolibc: Append extra cflags
Quoted 27 lines · Thomas Weißschuh
Hi Leo,
Quoted 13 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/testing/selftests/nolibc/Makefile.nolibc | 3 +++ 1 file changed, 3 insertions(+)tools/testing/selftests/nolibc/Makefile.nolibc +0
-0tools/testing/selftests/nolibc/Makefile.nolibc endif · line 256
Quoted 5 lines
tools/testing/selftests/nolibc/Makefile.nolibc +2
-0@@ -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.
Quoted 3 lines
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!
PATCH v3 30/30 selftests/sched_ext: Append extra cflags
In reply to Leo YanAppend EXTRA_CFLAGS to CFLAGS so that additional flags can be applied to the compiler.
--- tools/testing/selftests/sched_ext/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/sched_ext/Makefile +1 -0
@@ -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)
Signature · 1 line
2.34.1
Re: [PATCH v3 30/30] selftests/sched_ext: Append extra cflags
Quoted 4 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>
Thanks,
-Andrea
Quoted 20 lines
--- tools/testing/selftests/sched_ext/Makefile | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/sched_ext/Makefile +1
-0@@ -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)Signature · 2 lines
-- 2.34.1
Ian Rogers
reviewerRe: [PATCH v3 30/30] selftests/sched_ext: Append extra cflags
In reply to Leo YanQuoted 14 lines · Leo Yan
Append
EXTRA_CFLAGSto CFLAGS so that additional flags can be applied to the compiler.Signed-off-by Leo Yan <[email protected]>--- tools/testing/selftests/sched_ext/Makefile | 1 + 1 file changed, 1 insertion(+)tools/testing/selftests/sched_ext/Makefile +0
-0
tools/testing/selftests/sched_ext/Makefile ifneq ($(wildcard $(GENHDR)),) · line 59
Quoted 7 lines
tools/testing/selftests/sched_ext/Makefile +1
-0@@ -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
Quoted 3 lines
--
2.34.1