Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [PATCH stable 6.1 v2 0/5] perf build fixes
@ 2026-05-20 16:33 Florian Fainelli
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 1/5] perf build: Conditionally define NDEBUG Florian Fainelli
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Florian Fainelli @ 2026-05-20 16:33 UTC (permalink / raw)
  To: stable
  Cc: Florian Fainelli, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Nathan Chancellor, Nick Desaulniers,
	Tom Rix, Ian Rogers, open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

This patch series contains "perf" build fixes specific to 6.1. We have
seen occasional build failures in our CI looking like these:

util/parse-events-bison.c: In function 'yy_symbol_print':
util/parse-events-bison.c:901: error: unterminated #if
  901 | #if YYDEBUG
      |
util/parse-events-bison.c:1020:62: error: '_p' undeclared (first use in this function)
 1020 |   yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
      |                                                              ^~
util/parse-events-bison.c:1020:62: note: each undeclared identifier is reported only once for each function it appears in
util/parse-events-bison.c:1020:64: error: expected ')' at end of input
 1020 |   yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
      |                         ~                                      ^
      |                                                                )
 1021 |   YYFPRINTF (yyo, ")");
      |
util/parse-events-bison.c:1020:3: error: too few arguments to function 'yy_symbol_value_print'
 1020 |   yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
      |   ^~~~~~~~~~~~~~~~~~~~~
util/parse-events-bison.c:991:1: note: declared here
  991 | yy_symbol_value_print (FILE *yyo,
      | ^~~~~~~~~~~~~~~~~~~~~

which are resolved by these patches.

Changes in v2:

- backport change adding version-lt3 macro
- added fix for "perf build: Disable fewer bison warnings" per Sasha's review

Arnaldo Carvalho de Melo (2):
  tools build: Add 3-component logical version comparators
  perf build: Remove -Wno-unused-but-set-variable from the flex flags
    when building with clang < 13.0.0

Ian Rogers (3):
  perf build: Conditionally define NDEBUG
  perf parse-events: Make YYDEBUG dependent on doing a debug build
  perf build: Disable fewer bison warnings

 tools/perf/Makefile.config     |  1 +
 tools/perf/util/Build          | 32 +++++++++++++++++++++++++-------
 tools/perf/util/expr.y         |  4 +++-
 tools/perf/util/parse-events.y |  3 +++
 tools/perf/util/pmu.y          |  3 +++
 tools/scripts/utilities.mak    | 20 ++++++++++++++++++++
 6 files changed, 55 insertions(+), 8 deletions(-)

-- 
2.34.1


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

* [PATCH stable 6.1 v2 1/5] perf build: Conditionally define NDEBUG
  2026-05-20 16:33 [PATCH stable 6.1 v2 0/5] perf build fixes Florian Fainelli
@ 2026-05-20 16:33 ` Florian Fainelli
  2026-06-16 10:13   ` Patch "perf build: Conditionally define NDEBUG" has been added to the 6.1-stable tree gregkh
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 2/5] perf parse-events: Make YYDEBUG dependent on doing a debug build Florian Fainelli
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Florian Fainelli @ 2026-05-20 16:33 UTC (permalink / raw)
  To: stable
  Cc: Ian Rogers, Adrian Hunter, Alexander Shishkin, Ingo Molnar,
	Jiri Olsa, Mark Rutland, Namhyung Kim, Paolo Bonzini,
	Peter Zijlstra, Sean Christopherson, Arnaldo Carvalho de Melo,
	Florian Fainelli, Arnaldo Carvalho de Melo, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

From: Ian Rogers <irogers@google.com>

commit 616b14b47a86d880ba21a363440f20f82152d8f2 upstream

When a build is done without DEBUG=1 then define NDEBUG. This will
compile out asserts and other debug code.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20230330183827.1412303-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 tools/perf/Makefile.config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 249f3d841563..c54692976001 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -228,6 +228,7 @@ ifndef DEBUG
 endif
 
 ifeq ($(DEBUG),0)
+CORE_CFLAGS += -DNDEBUG=1
 ifeq ($(CC_NO_CLANG), 0)
   CORE_CFLAGS += -O3
 else
-- 
2.34.1


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

* [PATCH stable 6.1 v2 2/5] perf parse-events: Make YYDEBUG dependent on doing a debug build
  2026-05-20 16:33 [PATCH stable 6.1 v2 0/5] perf build fixes Florian Fainelli
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 1/5] perf build: Conditionally define NDEBUG Florian Fainelli
@ 2026-05-20 16:33 ` Florian Fainelli
  2026-06-16 10:13   ` Patch "perf parse-events: Make YYDEBUG dependent on doing a debug build" has been added to the 6.1-stable tree gregkh
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 3/5] perf build: Disable fewer bison warnings Florian Fainelli
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Florian Fainelli @ 2026-05-20 16:33 UTC (permalink / raw)
  To: stable
  Cc: Ian Rogers, Namhyung Kim, Adrian Hunter, Alexander Shishkin,
	Gaosheng Cui, Ingo Molnar, James Clark, Jiri Olsa, Kan Liang,
	Mark Rutland, Peter Zijlstra, Rob Herring, bpf,
	Arnaldo Carvalho de Melo, Florian Fainelli,
	Arnaldo Carvalho de Melo, Nathan Chancellor, Nick Desaulniers,
	Tom Rix, open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

From: Ian Rogers <irogers@google.com>

commit d4ce60190e08d84f88937019defa5e3d23409ac1 upstream

YYDEBUG enables line numbers and other error helpers in the generated
parse-events-bison.c. These shouldn't be generated when debugging
isn't enabled.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230911170559.4037734-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 tools/perf/util/parse-events.y | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index be8c51770051..dbc350a2c382 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -6,7 +6,9 @@
 
 %{
 
+#ifndef NDEBUG
 #define YYDEBUG 1
+#endif
 
 #include <fnmatch.h>
 #include <stdio.h>
-- 
2.34.1


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

* [PATCH stable 6.1 v2 3/5] perf build: Disable fewer bison warnings
  2026-05-20 16:33 [PATCH stable 6.1 v2 0/5] perf build fixes Florian Fainelli
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 1/5] perf build: Conditionally define NDEBUG Florian Fainelli
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 2/5] perf parse-events: Make YYDEBUG dependent on doing a debug build Florian Fainelli
@ 2026-05-20 16:33 ` Florian Fainelli
  2026-06-16 10:13   ` Patch "perf build: Disable fewer bison warnings" has been added to the 6.1-stable tree gregkh
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 4/5] tools build: Add 3-component logical version comparators Florian Fainelli
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Florian Fainelli
  4 siblings, 1 reply; 14+ messages in thread
From: Florian Fainelli @ 2026-05-20 16:33 UTC (permalink / raw)
  To: stable
  Cc: Ian Rogers, Adrian Hunter, Alexander Shishkin, Andrii Nakryiko,
	Eduard Zingerman, Gaosheng Cui, Ingo Molnar, Jiri Olsa, Kan Liang,
	Mark Rutland, Namhyung Kim, Nathan Chancellor, Nick Desaulniers,
	Peter Zijlstra, Rob Herring, Tom Rix, bpf, llvm,
	Arnaldo Carvalho de Melo, Florian Fainelli,
	Arnaldo Carvalho de Melo, open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, bcm-kernel-feedback-list

From: Ian Rogers <irogers@google.com>

commit ddc8e4c966923ad1137790817157c8a5f0301aec upstream

If bison is version 3.8.2, reduce the number of bison C warnings
disabled. Earlier bison versions have all C warnings disabled. Avoid
implicit declarations of yylex by adding the declaration in the C
file. A header can't be included as a circular dependency would occur
due to the lexer using the bison defined tokens.

Committer notes:

Some recent versions of gcc and clang (noticed on Alpine Linux 3.17,
edge, clearlinux, fedora 37, etc.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Tom Rix <trix@redhat.com>
Cc: bpf@vger.kernel.org
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230728064917.767761-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[florian: Remove non-existent tools/perf/util/bpf-filter.y in 6.1.y]
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Change-Id: I62327ddbe816008197053a9234a92d9c253a2c5d
---
 tools/perf/util/Build          | 12 ++++++++----
 tools/perf/util/expr.y         |  4 +++-
 tools/perf/util/parse-events.y |  1 +
 tools/perf/util/pmu.y          |  3 +++
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 2c364a9087a2..036f9780b398 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -269,10 +269,14 @@ CFLAGS_parse-events-flex.o  += $(flex_flags)
 CFLAGS_pmu-flex.o           += $(flex_flags)
 CFLAGS_expr-flex.o          += $(flex_flags)
 
-bison_flags := -DYYENABLE_NLS=0
-BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
-ifeq ($(BISON_GE_35),1)
-  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
+# Some newer clang and gcc version complain about this
+# util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
+#  int yynerrs = 0;
+
+bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
+BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
+ifeq ($(BISON_GE_382),1)
+  bison_flags += -Wno-switch-enum
 else
   bison_flags += -w
 endif
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index 635e562350c5..b8745d564b78 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -7,6 +7,8 @@
 #include "util/debug.h"
 #define IN_EXPR_Y 1
 #include "expr.h"
+#include "expr-bison.h"
+int expr_lex(YYSTYPE * yylval_param , void *yyscanner);
 %}
 
 %define api.pure full
@@ -56,7 +58,7 @@
 static void expr_error(double *final_val __maybe_unused,
 		       struct expr_parse_ctx *ctx __maybe_unused,
 		       bool compute_ids __maybe_unused,
-		       void *scanner,
+		       void *scanner __maybe_unused,
 		       const char *s)
 {
 	pr_debug("%s\n", s);
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index dbc350a2c382..42d4414760e3 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -20,6 +20,7 @@
 #include "parse-events.h"
 #include "parse-events-bison.h"
 
+int parse_events_lex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , void *yyscanner);
 void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
 
 #define ABORT_ON(val) \
diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
index e675d79a0274..ae88d2d2dd6a 100644
--- a/tools/perf/util/pmu.y
+++ b/tools/perf/util/pmu.y
@@ -9,6 +9,9 @@
 #include <linux/bitmap.h>
 #include <string.h>
 #include "pmu.h"
+#include "pmu-bison.h"
+
+int perf_pmu_lex(void);
 
 #define ABORT_ON(val) \
 do { \
-- 
2.34.1


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

* [PATCH stable 6.1 v2 4/5] tools build: Add 3-component logical version comparators
  2026-05-20 16:33 [PATCH stable 6.1 v2 0/5] perf build fixes Florian Fainelli
                   ` (2 preceding siblings ...)
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 3/5] perf build: Disable fewer bison warnings Florian Fainelli
@ 2026-05-20 16:33 ` Florian Fainelli
  2026-06-16 10:13   ` Patch "tools build: Add 3-component logical version comparators" has been added to the 6.1-stable tree gregkh
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Florian Fainelli
  4 siblings, 1 reply; 14+ messages in thread
From: Florian Fainelli @ 2026-05-20 16:33 UTC (permalink / raw)
  To: stable
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Ian Rogers, Jiri Olsa,
	Namhyung Kim, Florian Fainelli, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Nathan Chancellor, Nick Desaulniers, Tom Rix,
	open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

From: Arnaldo Carvalho de Melo <acme@redhat.com>

commit a9b451509565d40a5ca3b41c39a2b758cdbc5355 upstream

The next cset needs to compare if a flex version is greater or
equal/less than another, but since there is no canonical, generally
available way to compare versions in the command line (sort -V, yeah,
but...), just use awk to canonicalize the versions like is also done in
scripts/rust_is_available.sh.

There was a problem spotted in linux-next where a bashism, here
documents, aka the '<<<' stdin redirector, for strings to be used as the
stdin for awk. Use $(shell echo | awk ...) instead.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 tools/scripts/utilities.mak | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/scripts/utilities.mak b/tools/scripts/utilities.mak
index 172e47273b5d..d69d0345cc23 100644
--- a/tools/scripts/utilities.mak
+++ b/tools/scripts/utilities.mak
@@ -177,3 +177,23 @@ $(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2)))
 endef
 _ge_attempt = $(or $(get-executable),$(call _gea_err,$(2)))
 _gea_err  = $(if $(1),$(error Please set '$(1)' appropriately))
+
+# version-ge3
+#
+# Usage $(call version-ge3,2.6.4,$(FLEX_VERSION))
+#
+# To compare if a 3 component version is greater or equal to another, first use
+# was to check the flex version to see if we can use compiler warnings as
+# errors for one of the cases flex generates code C compilers complains about.
+
+version-ge3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) >= (10000000 * $$4 + 10000 * $$5 + $$6)) }')
+
+# version-lt3
+#
+# Usage $(call version-lt3,2.6.2,$(FLEX_VERSION))
+#
+# To compare if a 3 component version is less thjan another, first use was to
+# check the flex version to see if we can use compiler warnings as errors for
+# one of the cases flex generates code C compilers complains about.
+
+version-lt3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) < (10000000 * $$4 + 10000 * $$5 + $$6)) }')
-- 
2.34.1


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

* [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
  2026-05-20 16:33 [PATCH stable 6.1 v2 0/5] perf build fixes Florian Fainelli
                   ` (3 preceding siblings ...)
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 4/5] tools build: Add 3-component logical version comparators Florian Fainelli
@ 2026-05-20 16:33 ` Florian Fainelli
  2026-05-20 16:35   ` Florian Fainelli
                     ` (2 more replies)
  4 siblings, 3 replies; 14+ messages in thread
From: Florian Fainelli @ 2026-05-20 16:33 UTC (permalink / raw)
  To: stable
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Ian Rogers, Jiri Olsa,
	Namhyung Kim, Florian Fainelli, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Nathan Chancellor, Nick Desaulniers, Tom Rix,
	open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

From: Arnaldo Carvalho de Melo <acme@redhat.com>

clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove
it to avoid:

  error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
  make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128: /tmp/build/perf/util/pmu-flex.o] Error 1
  make[4]: *** Waiting for unfinished jobs....

Fixes: ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/ZNUSWr52jUnVaaa%2F@kernel.org/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Change-Id: I8db8a372d1e83d26fbe8beda2bcf4d1a871a2b80
---
 tools/perf/util/Build | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 036f9780b398..43f74f5b96f8 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -1,3 +1,6 @@
+include $(srctree)/tools/scripts/Makefile.include
+include $(srctree)/tools/scripts/utilities.mak
+
 perf-y += arm64-frame-pointer-unwind-support.o
 perf-y += annotate.o
 perf-y += block-info.o
@@ -265,15 +268,22 @@ ifeq ($(FLEX_GE_26),1)
 else
   flex_flags := -w
 endif
-CFLAGS_parse-events-flex.o  += $(flex_flags)
-CFLAGS_pmu-flex.o           += $(flex_flags)
-CFLAGS_expr-flex.o          += $(flex_flags)
 
 # Some newer clang and gcc version complain about this
 # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
 #  int yynerrs = 0;
 
 bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
+
+# Old clangs don't grok -Wno-unused-but-set-variable, remove it
+ifeq ($(CC_NO_CLANG), 0)
+  CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')
+  ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1)
+    bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags))
+    flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))
+  endif
+endif
+
 BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
 ifeq ($(BISON_GE_382),1)
   bison_flags += -Wno-switch-enum
@@ -286,6 +296,10 @@ ifeq ($(BISON_LT_381),1)
   bison_flags += -DYYNOMEM=YYABORT
 endif
 
+CFLAGS_parse-events-flex.o  += $(flex_flags)
+CFLAGS_pmu-flex.o           += $(flex_flags)
+CFLAGS_expr-flex.o          += $(flex_flags)
+
 CFLAGS_parse-events-bison.o += $(bison_flags)
 CFLAGS_pmu-bison.o          += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
 CFLAGS_expr-bison.o         += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
-- 
2.34.1


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

* Re: [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Florian Fainelli
@ 2026-05-20 16:35   ` Florian Fainelli
  2026-06-16 10:12     ` Greg KH
  2026-06-16 10:13   ` Patch "perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0" has been added to the 6.1-stable tree gregkh
  2026-06-16 11:59   ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Greg KH
  2 siblings, 1 reply; 14+ messages in thread
From: Florian Fainelli @ 2026-05-20 16:35 UTC (permalink / raw)
  To: stable
  Cc: Arnaldo Carvalho de Melo, Adrian Hunter, Ian Rogers, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Nathan Chancellor, Nick Desaulniers, Tom Rix,
	open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

On 5/20/26 09:33, Florian Fainelli wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove
> it to avoid:
> 
>    error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>    make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128: /tmp/build/perf/util/pmu-flex.o] Error 1
>    make[4]: *** Waiting for unfinished jobs....
> 
> Fixes: ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Link: https://lore.kernel.org/lkml/ZNUSWr52jUnVaaa%2F@kernel.org/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> Change-Id: I8db8a372d1e83d26fbe8beda2bcf4d1a871a2b80

Argh, sorry the Change-Id snuck in there, let me know if you need me to 
resubmit.
-- 
Florian

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

* Re: [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
  2026-05-20 16:35   ` Florian Fainelli
@ 2026-06-16 10:12     ` Greg KH
  0 siblings, 0 replies; 14+ messages in thread
From: Greg KH @ 2026-06-16 10:12 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: stable, Arnaldo Carvalho de Melo, Adrian Hunter, Ian Rogers,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Nathan Chancellor, Nick Desaulniers, Tom Rix,
	open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

On Wed, May 20, 2026 at 09:35:02AM -0700, Florian Fainelli wrote:
> On 5/20/26 09:33, Florian Fainelli wrote:
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > 
> > clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove
> > it to avoid:
> > 
> >    error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
> >    make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128: /tmp/build/perf/util/pmu-flex.o] Error 1
> >    make[4]: *** Waiting for unfinished jobs....
> > 
> > Fixes: ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Link: https://lore.kernel.org/lkml/ZNUSWr52jUnVaaa%2F@kernel.org/
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> > Change-Id: I8db8a372d1e83d26fbe8beda2bcf4d1a871a2b80
> 
> Argh, sorry the Change-Id snuck in there, let me know if you need me to
> resubmit.

I got it, no worries.

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

* Patch "perf build: Conditionally define NDEBUG" has been added to the 6.1-stable tree
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 1/5] perf build: Conditionally define NDEBUG Florian Fainelli
@ 2026-06-16 10:13   ` gregkh
  0 siblings, 0 replies; 14+ messages in thread
From: gregkh @ 2026-06-16 10:13 UTC (permalink / raw)
  To: acme, acme, adrian.hunter, alexander.shishkin,
	bcm-kernel-feedback-list, florian.fainelli, gregkh, irogers,
	jolsa, llvm, mark.rutland, mingo, namhyung, nathan, ndesaulniers,
	pbonzini, peterz, seanjc, trix
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    perf build: Conditionally define NDEBUG

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-build-conditionally-define-ndebug.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From stable+bounces-250203-greg=kroah.com@vger.kernel.org Wed May 20 22:29:26 2026
From: Florian Fainelli <florian.fainelli@broadcom.com>
Date: Wed, 20 May 2026 09:33:16 -0700
Subject: perf build: Conditionally define NDEBUG
To: stable@vger.kernel.org
Cc: Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Ingo Molnar <mingo@redhat.com>, Jiri Olsa <jolsa@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Namhyung Kim <namhyung@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Sean Christopherson <seanjc@google.com>, Arnaldo Carvalho de Melo <acme@redhat.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-perf-users@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), linux-kernel@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), bpf@vger.kernel.org (open list:BPF [MISC]), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT), bcm-kernel-feedback-list@broadcom.com
Message-ID: <20260520163320.3073037-2-florian.fainelli@broadcom.com>

From: Ian Rogers <irogers@google.com>

commit 616b14b47a86d880ba21a363440f20f82152d8f2 upstream

When a build is done without DEBUG=1 then define NDEBUG. This will
compile out asserts and other debug code.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20230330183827.1412303-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/perf/Makefile.config |    1 +
 1 file changed, 1 insertion(+)

--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -228,6 +228,7 @@ ifndef DEBUG
 endif
 
 ifeq ($(DEBUG),0)
+CORE_CFLAGS += -DNDEBUG=1
 ifeq ($(CC_NO_CLANG), 0)
   CORE_CFLAGS += -O3
 else


Patches currently in stable-queue which might be from florian.fainelli@broadcom.com are

queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
queue-6.1/perf-build-conditionally-define-ndebug.patch
queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
queue-6.1/perf-build-disable-fewer-bison-warnings.patch
queue-6.1/tools-build-add-3-component-logical-version-comparators.patch

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

* Patch "perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0" has been added to the 6.1-stable tree
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Florian Fainelli
  2026-05-20 16:35   ` Florian Fainelli
@ 2026-06-16 10:13   ` gregkh
  2026-06-16 11:59   ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Greg KH
  2 siblings, 0 replies; 14+ messages in thread
From: gregkh @ 2026-06-16 10:13 UTC (permalink / raw)
  To: acme, acme, adrian.hunter, alexander.shishkin,
	bcm-kernel-feedback-list, florian.fainelli, gregkh, irogers,
	jolsa, llvm, mark.rutland, mingo, namhyung, nathan, ndesaulniers,
	peterz, trix
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From stable+bounces-250209-greg=kroah.com@vger.kernel.org Wed May 20 22:59:29 2026
From: Florian Fainelli <florian.fainelli@broadcom.com>
Date: Wed, 20 May 2026 09:33:20 -0700
Subject: perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
To: stable@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>, Adrian Hunter <adrian.hunter@intel.com>, Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Florian Fainelli <florian.fainelli@broadcom.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-perf-users@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), linux-kernel@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), bpf@vger.kernel.org (open list:BPF [MISC]), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT), bcm-kernel-feedback-list@broadcom.com
Message-ID: <20260520163320.3073037-6-florian.fainelli@broadcom.com>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove
it to avoid:

  error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
  make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128: /tmp/build/perf/util/pmu-flex.o] Error 1
  make[4]: *** Waiting for unfinished jobs....

Fixes: ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/ZNUSWr52jUnVaaa%2F@kernel.org/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/perf/util/Build |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -1,3 +1,6 @@
+include $(srctree)/tools/scripts/Makefile.include
+include $(srctree)/tools/scripts/utilities.mak
+
 perf-y += arm64-frame-pointer-unwind-support.o
 perf-y += annotate.o
 perf-y += block-info.o
@@ -265,15 +268,22 @@ ifeq ($(FLEX_GE_26),1)
 else
   flex_flags := -w
 endif
-CFLAGS_parse-events-flex.o  += $(flex_flags)
-CFLAGS_pmu-flex.o           += $(flex_flags)
-CFLAGS_expr-flex.o          += $(flex_flags)
 
 # Some newer clang and gcc version complain about this
 # util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
 #  int yynerrs = 0;
 
 bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
+
+# Old clangs don't grok -Wno-unused-but-set-variable, remove it
+ifeq ($(CC_NO_CLANG), 0)
+  CLANG_VERSION := $(shell $(CLANG) --version | head -1 | sed 's/.*clang version \([[:digit:]]\+.[[:digit:]]\+.[[:digit:]]\+\).*/\1/g')
+  ifeq ($(call version-lt3,$(CLANG_VERSION),13.0.0),1)
+    bison_flags := $(subst -Wno-unused-but-set-variable,,$(bison_flags))
+    flex_flags := $(subst -Wno-unused-but-set-variable,,$(flex_flags))
+  endif
+endif
+
 BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
 ifeq ($(BISON_GE_382),1)
   bison_flags += -Wno-switch-enum
@@ -286,6 +296,10 @@ ifeq ($(BISON_LT_381),1)
   bison_flags += -DYYNOMEM=YYABORT
 endif
 
+CFLAGS_parse-events-flex.o  += $(flex_flags)
+CFLAGS_pmu-flex.o           += $(flex_flags)
+CFLAGS_expr-flex.o          += $(flex_flags)
+
 CFLAGS_parse-events-bison.o += $(bison_flags)
 CFLAGS_pmu-bison.o          += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)
 CFLAGS_expr-bison.o         += -DYYLTYPE_IS_TRIVIAL=0 $(bison_flags)


Patches currently in stable-queue which might be from florian.fainelli@broadcom.com are

queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
queue-6.1/perf-build-conditionally-define-ndebug.patch
queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
queue-6.1/perf-build-disable-fewer-bison-warnings.patch
queue-6.1/tools-build-add-3-component-logical-version-comparators.patch

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

* Patch "perf build: Disable fewer bison warnings" has been added to the 6.1-stable tree
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 3/5] perf build: Disable fewer bison warnings Florian Fainelli
@ 2026-06-16 10:13   ` gregkh
  0 siblings, 0 replies; 14+ messages in thread
From: gregkh @ 2026-06-16 10:13 UTC (permalink / raw)
  To: acme, acme, adrian.hunter, alexander.shishkin, andrii,
	bcm-kernel-feedback-list, cuigaosheng1, eddyz87, florian.fainelli,
	gregkh, irogers, jolsa, kan.liang, llvm, mark.rutland, mingo,
	namhyung, nathan, ndesaulniers, peterz, robh, trix
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    perf build: Disable fewer bison warnings

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-build-disable-fewer-bison-warnings.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From stable+bounces-250206-greg=kroah.com@vger.kernel.org Wed May 20 22:58:58 2026
From: Florian Fainelli <florian.fainelli@broadcom.com>
Date: Wed, 20 May 2026 09:33:18 -0700
Subject: perf build: Disable fewer bison warnings
To: stable@vger.kernel.org
Cc: Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>, Gaosheng Cui <cuigaosheng1@huawei.com>, Ingo Molnar <mingo@redhat.com>, Jiri Olsa <jolsa@kernel.org>, Kan Liang <kan.liang@linux.intel.com>, Mark Rutland <mark.rutland@arm.com>, Namhyung Kim <namhyung@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Peter Zijlstra <peterz@infradead.org>, Rob Herring <robh@kernel.org>, Tom Rix <trix@redhat.com>, bpf@vger.kernel.org, llvm@lists.linux.dev, Arnaldo Carvalho de Melo <acme@redhat.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, linux-perf-users@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), linux-kernel@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), bcm-kernel-feedback-list@broadcom.com
Message-ID: <20260520163320.3073037-4-florian.fainelli@broadcom.com>

From: Ian Rogers <irogers@google.com>

commit ddc8e4c966923ad1137790817157c8a5f0301aec upstream

If bison is version 3.8.2, reduce the number of bison C warnings
disabled. Earlier bison versions have all C warnings disabled. Avoid
implicit declarations of yylex by adding the declaration in the C
file. A header can't be included as a circular dependency would occur
due to the lexer using the bison defined tokens.

Committer notes:

Some recent versions of gcc and clang (noticed on Alpine Linux 3.17,
edge, clearlinux, fedora 37, etc.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Tom Rix <trix@redhat.com>
Cc: bpf@vger.kernel.org
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230728064917.767761-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[florian: Remove non-existent tools/perf/util/bpf-filter.y in 6.1.y]
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Change-Id: I62327ddbe816008197053a9234a92d9c253a2c5d
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/perf/util/Build          |   12 ++++++++----
 tools/perf/util/expr.y         |    4 +++-
 tools/perf/util/parse-events.y |    1 +
 tools/perf/util/pmu.y          |    3 +++
 4 files changed, 15 insertions(+), 5 deletions(-)

--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -269,10 +269,14 @@ CFLAGS_parse-events-flex.o  += $(flex_fl
 CFLAGS_pmu-flex.o           += $(flex_flags)
 CFLAGS_expr-flex.o          += $(flex_flags)
 
-bison_flags := -DYYENABLE_NLS=0
-BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
-ifeq ($(BISON_GE_35),1)
-  bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
+# Some newer clang and gcc version complain about this
+# util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
+#  int yynerrs = 0;
+
+bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
+BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
+ifeq ($(BISON_GE_382),1)
+  bison_flags += -Wno-switch-enum
 else
   bison_flags += -w
 endif
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -7,6 +7,8 @@
 #include "util/debug.h"
 #define IN_EXPR_Y 1
 #include "expr.h"
+#include "expr-bison.h"
+int expr_lex(YYSTYPE * yylval_param , void *yyscanner);
 %}
 
 %define api.pure full
@@ -56,7 +58,7 @@
 static void expr_error(double *final_val __maybe_unused,
 		       struct expr_parse_ctx *ctx __maybe_unused,
 		       bool compute_ids __maybe_unused,
-		       void *scanner,
+		       void *scanner __maybe_unused,
 		       const char *s)
 {
 	pr_debug("%s\n", s);
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -20,6 +20,7 @@
 #include "parse-events.h"
 #include "parse-events-bison.h"
 
+int parse_events_lex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , void *yyscanner);
 void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
 
 #define ABORT_ON(val) \
--- a/tools/perf/util/pmu.y
+++ b/tools/perf/util/pmu.y
@@ -9,6 +9,9 @@
 #include <linux/bitmap.h>
 #include <string.h>
 #include "pmu.h"
+#include "pmu-bison.h"
+
+int perf_pmu_lex(void);
 
 #define ABORT_ON(val) \
 do { \


Patches currently in stable-queue which might be from florian.fainelli@broadcom.com are

queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
queue-6.1/perf-build-conditionally-define-ndebug.patch
queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
queue-6.1/perf-build-disable-fewer-bison-warnings.patch
queue-6.1/tools-build-add-3-component-logical-version-comparators.patch

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

* Patch "tools build: Add 3-component logical version comparators" has been added to the 6.1-stable tree
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 4/5] tools build: Add 3-component logical version comparators Florian Fainelli
@ 2026-06-16 10:13   ` gregkh
  0 siblings, 0 replies; 14+ messages in thread
From: gregkh @ 2026-06-16 10:13 UTC (permalink / raw)
  To: acme, acme, adrian.hunter, alexander.shishkin,
	bcm-kernel-feedback-list, florian.fainelli, gregkh, irogers,
	jolsa, llvm, mark.rutland, mingo, namhyung, nathan, ndesaulniers,
	peterz, trix
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    tools build: Add 3-component logical version comparators

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tools-build-add-3-component-logical-version-comparators.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From stable+bounces-250208-greg=kroah.com@vger.kernel.org Thu May 21 01:09:09 2026
From: Florian Fainelli <florian.fainelli@broadcom.com>
Date: Wed, 20 May 2026 09:33:19 -0700
Subject: tools build: Add 3-component logical version comparators
To: stable@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>, Adrian Hunter <adrian.hunter@intel.com>, Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Florian Fainelli <florian.fainelli@broadcom.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-perf-users@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), linux-kernel@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), bpf@vger.kernel.org (open list:BPF [MISC]), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT), bcm-kernel-feedback-list@broadcom.com
Message-ID: <20260520163320.3073037-5-florian.fainelli@broadcom.com>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

commit a9b451509565d40a5ca3b41c39a2b758cdbc5355 upstream

The next cset needs to compare if a flex version is greater or
equal/less than another, but since there is no canonical, generally
available way to compare versions in the command line (sort -V, yeah,
but...), just use awk to canonicalize the versions like is also done in
scripts/rust_is_available.sh.

There was a problem spotted in linux-next where a bashism, here
documents, aka the '<<<' stdin redirector, for strings to be used as the
stdin for awk. Use $(shell echo | awk ...) instead.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/scripts/utilities.mak |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

--- a/tools/scripts/utilities.mak
+++ b/tools/scripts/utilities.mak
@@ -177,3 +177,23 @@ $(if $($(1)),$(call _ge_attempt,$($(1)),
 endef
 _ge_attempt = $(or $(get-executable),$(call _gea_err,$(2)))
 _gea_err  = $(if $(1),$(error Please set '$(1)' appropriately))
+
+# version-ge3
+#
+# Usage $(call version-ge3,2.6.4,$(FLEX_VERSION))
+#
+# To compare if a 3 component version is greater or equal to another, first use
+# was to check the flex version to see if we can use compiler warnings as
+# errors for one of the cases flex generates code C compilers complains about.
+
+version-ge3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) >= (10000000 * $$4 + 10000 * $$5 + $$6)) }')
+
+# version-lt3
+#
+# Usage $(call version-lt3,2.6.2,$(FLEX_VERSION))
+#
+# To compare if a 3 component version is less thjan another, first use was to
+# check the flex version to see if we can use compiler warnings as errors for
+# one of the cases flex generates code C compilers complains about.
+
+version-lt3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) < (10000000 * $$4 + 10000 * $$5 + $$6)) }')


Patches currently in stable-queue which might be from florian.fainelli@broadcom.com are

queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
queue-6.1/perf-build-conditionally-define-ndebug.patch
queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
queue-6.1/perf-build-disable-fewer-bison-warnings.patch
queue-6.1/tools-build-add-3-component-logical-version-comparators.patch

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

* Patch "perf parse-events: Make YYDEBUG dependent on doing a debug build" has been added to the 6.1-stable tree
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 2/5] perf parse-events: Make YYDEBUG dependent on doing a debug build Florian Fainelli
@ 2026-06-16 10:13   ` gregkh
  0 siblings, 0 replies; 14+ messages in thread
From: gregkh @ 2026-06-16 10:13 UTC (permalink / raw)
  To: acme, acme, adrian.hunter, alexander.shishkin,
	bcm-kernel-feedback-list, cuigaosheng1, florian.fainelli, gregkh,
	irogers, james.clark, jolsa, kan.liang, llvm, mark.rutland, mingo,
	namhyung, nathan, ndesaulniers, peterz, robh, trix
  Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    perf parse-events: Make YYDEBUG dependent on doing a debug build

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From stable+bounces-250204-greg=kroah.com@vger.kernel.org Wed May 20 22:58:26 2026
From: Florian Fainelli <florian.fainelli@broadcom.com>
Date: Wed, 20 May 2026 09:33:17 -0700
Subject: perf parse-events: Make YYDEBUG dependent on doing a debug build
To: stable@vger.kernel.org
Cc: Ian Rogers <irogers@google.com>, Namhyung Kim <namhyung@kernel.org>, Adrian Hunter <adrian.hunter@intel.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Gaosheng Cui <cuigaosheng1@huawei.com>, Ingo Molnar <mingo@redhat.com>, James Clark <james.clark@arm.com>, Jiri Olsa <jolsa@kernel.org>, Kan Liang <kan.liang@linux.intel.com>, Mark Rutland <mark.rutland@arm.com>, Peter Zijlstra <peterz@infradead.org>, Rob Herring <robh@kernel.org>, bpf@vger.kernel.org, Arnaldo Carvalho de Melo <acme@redhat.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, linux-perf-users@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), linux-kernel@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT), bcm-kernel-feedback-list@broadcom.com
Message-ID: <20260520163320.3073037-3-florian.fainelli@broadcom.com>

From: Ian Rogers <irogers@google.com>

commit d4ce60190e08d84f88937019defa5e3d23409ac1 upstream

YYDEBUG enables line numbers and other error helpers in the generated
parse-events-bison.c. These shouldn't be generated when debugging
isn't enabled.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230911170559.4037734-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 tools/perf/util/parse-events.y |    2 ++
 1 file changed, 2 insertions(+)

--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -6,7 +6,9 @@
 
 %{
 
+#ifndef NDEBUG
 #define YYDEBUG 1
+#endif
 
 #include <fnmatch.h>
 #include <stdio.h>


Patches currently in stable-queue which might be from florian.fainelli@broadcom.com are

queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
queue-6.1/perf-build-conditionally-define-ndebug.patch
queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
queue-6.1/perf-build-disable-fewer-bison-warnings.patch
queue-6.1/tools-build-add-3-component-logical-version-comparators.patch

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

* Re: [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0
  2026-05-20 16:33 ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Florian Fainelli
  2026-05-20 16:35   ` Florian Fainelli
  2026-06-16 10:13   ` Patch "perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0" has been added to the 6.1-stable tree gregkh
@ 2026-06-16 11:59   ` Greg KH
  2 siblings, 0 replies; 14+ messages in thread
From: Greg KH @ 2026-06-16 11:59 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: stable, Arnaldo Carvalho de Melo, Adrian Hunter, Ian Rogers,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Nathan Chancellor, Nick Desaulniers, Tom Rix,
	open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
	open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list

On Wed, May 20, 2026 at 09:33:20AM -0700, Florian Fainelli wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> clang < 13.0.0 doesn't grok -Wno-unused-but-set-variable, so just remove
> it to avoid:
> 
>   error: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Werror,-Wunknown-warning-option]
>   make[4]: *** [/git/perf-6.5.0-rc4/tools/build/Makefile.build:128: /tmp/build/perf/util/pmu-flex.o] Error 1
>   make[4]: *** Waiting for unfinished jobs....
> 
> Fixes: ddc8e4c966923ad1 ("perf build: Disable fewer bison warnings")
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Link: https://lore.kernel.org/lkml/ZNUSWr52jUnVaaa%2F@kernel.org/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> ---
>  tools/perf/util/Build | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 

Oops, no upstream git id?  What is it?

thanks,

greg k-h


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

end of thread, other threads:[~2026-06-16 12:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20 16:33 [PATCH stable 6.1 v2 0/5] perf build fixes Florian Fainelli
2026-05-20 16:33 ` [PATCH stable 6.1 v2 1/5] perf build: Conditionally define NDEBUG Florian Fainelli
2026-06-16 10:13   ` Patch "perf build: Conditionally define NDEBUG" has been added to the 6.1-stable tree gregkh
2026-05-20 16:33 ` [PATCH stable 6.1 v2 2/5] perf parse-events: Make YYDEBUG dependent on doing a debug build Florian Fainelli
2026-06-16 10:13   ` Patch "perf parse-events: Make YYDEBUG dependent on doing a debug build" has been added to the 6.1-stable tree gregkh
2026-05-20 16:33 ` [PATCH stable 6.1 v2 3/5] perf build: Disable fewer bison warnings Florian Fainelli
2026-06-16 10:13   ` Patch "perf build: Disable fewer bison warnings" has been added to the 6.1-stable tree gregkh
2026-05-20 16:33 ` [PATCH stable 6.1 v2 4/5] tools build: Add 3-component logical version comparators Florian Fainelli
2026-06-16 10:13   ` Patch "tools build: Add 3-component logical version comparators" has been added to the 6.1-stable tree gregkh
2026-05-20 16:33 ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Florian Fainelli
2026-05-20 16:35   ` Florian Fainelli
2026-06-16 10:12     ` Greg KH
2026-06-16 10:13   ` Patch "perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0" has been added to the 6.1-stable tree gregkh
2026-06-16 11:59   ` [PATCH stable 6.1 v2 5/5] perf build: Remove -Wno-unused-but-set-variable from the flex flags when building with clang < 13.0.0 Greg KH

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