[PATCH v3 24/30] tools: tracing: Append extra cflags

Leo Yan posted 30 patches 1 month ago
There is a newer version of this series
[PATCH v3 24/30] tools: tracing: Append extra cflags
Posted by Leo Yan 1 month ago
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
Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
Posted by Steven Rostedt 1 month ago
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
Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
Posted by Ian Rogers 1 month ago
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
Re: [PATCH v3 24/30] tools: tracing: Append extra cflags
Posted by Leo Yan 1 month ago
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