[PATCH v3 10/30] tools build: Append extra cflags for feature

Leo Yan posted 30 patches 1 month ago
There is a newer version of this series
[PATCH v3 10/30] tools build: Append extra cflags for feature
Posted by Leo Yan 1 month ago
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
Re: [PATCH v3 10/30] tools build: Append extra cflags for feature
Posted by Ian Rogers 1 month ago
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
>
Re: [PATCH v3 10/30] tools build: Append extra cflags for feature
Posted by Leo Yan 4 weeks, 1 day ago
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