]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Jun 2026 10:13:43 +0000 (15:43 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Jun 2026 10:13:43 +0000 (15:43 +0530)
added patches:
perf-build-conditionally-define-ndebug.patch
perf-build-disable-fewer-bison-warnings.patch
perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
tools-build-add-3-component-logical-version-comparators.patch

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

diff --git a/queue-6.1/perf-build-conditionally-define-ndebug.patch b/queue-6.1/perf-build-conditionally-define-ndebug.patch
new file mode 100644 (file)
index 0000000..b9d9573
--- /dev/null
@@ -0,0 +1,43 @@
+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
diff --git a/queue-6.1/perf-build-disable-fewer-bison-warnings.patch b/queue-6.1/perf-build-disable-fewer-bison-warnings.patch
new file mode 100644 (file)
index 0000000..ccc5e49
--- /dev/null
@@ -0,0 +1,117 @@
+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 { \
diff --git a/queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch b/queue-6.1/perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
new file mode 100644 (file)
index 0000000..1264625
--- /dev/null
@@ -0,0 +1,76 @@
+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)
diff --git a/queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch b/queue-6.1/perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
new file mode 100644 (file)
index 0000000..621ea29
--- /dev/null
@@ -0,0 +1,49 @@
+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>
index 0b2ac10f34912bc09c1eea907d9988e72e948bb6..f40269c527d112244f46c263ac80c3442299a955 100644 (file)
@@ -492,3 +492,8 @@ blk-cgroup-fix-null-deref-caused-by-blkg_policy_data-being-installed-before-init
 batman-adv-stop-tp_meter-sessions-during-mesh-teardown.patch
 batman-adv-tp_meter-fix-tp_num-leak-on-kmalloc-failure.patch
 alsa-hda-hdmi-add-quirk-for-tuxedo-ibs14g6.patch
+perf-build-conditionally-define-ndebug.patch
+perf-parse-events-make-yydebug-dependent-on-doing-a-debug-build.patch
+perf-build-disable-fewer-bison-warnings.patch
+tools-build-add-3-component-logical-version-comparators.patch
+perf-build-remove-wno-unused-but-set-variable-from-the-flex-flags-when-building-with-clang-13.0.0.patch
diff --git a/queue-6.1/tools-build-add-3-component-logical-version-comparators.patch b/queue-6.1/tools-build-add-3-component-logical-version-comparators.patch
new file mode 100644 (file)
index 0000000..76ddf82
--- /dev/null
@@ -0,0 +1,59 @@
+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)) }')