lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMgkthavch7x/z+0@kernel.org>
Date:   Mon, 31 Jul 2023 18:16:38 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     James Clark <james.clark@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Rix <trix@...hat.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Eduard Zingerman <eddyz87@...il.com>,
        Andrii Nakryiko <andrii@...nel.org>,
        Gaosheng Cui <cuigaosheng1@...wei.com>,
        Rob Herring <robh@...nel.org>,
        linux-perf-users <linux-perf-users@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        llvm@...ts.linux.dev
Subject: Re: [PATCH v1 4/6] perf build: Disable fewer flex warnings

Em Fri, Jul 28, 2023 at 12:05:56PM -0700, Ian Rogers escreveu:
> On Fri, Jul 28, 2023, 11:43 AM Arnaldo Carvalho de Melo <acme@...nel.org>
> > > I haven't checked, lemme do it now.

> > It comes directly from flex's m4 files:

> > https://github.com/westes/flex/blob/master/src/c99-flex.skl#L2044

> > So I'll keep the -Wno-misleading-indentation, ok?
 
> Makes sense, yes.

continuing, changed the version check to:

commit f4da4419574536691c6b7843b6c48a3f97240404
Author: Ian Rogers <irogers@...gle.com>
Date:   Thu Jul 27 23:49:15 2023 -0700

    perf build: Disable fewer flex warnings
    
    If flex is version 2.6.4, reduce the number of flex C warnings
    disabled. Earlier flex versions have all C warnings disabled.
    
    Committer notes:
    
    Added this to the list of ignored warnings to get it building on
    a Fedora 36 machine with flex 2.6.4:
    
      -Wno-misleading-indentation
    
    Noticed when building with:
    
      $ make LLVM=1 -C tools/perf NO_BPF_SKEL=1 DEBUG=1
    
    Take two:
    
    We can't just try to canonicalize flex versions by just removing the
    dots, as we end up with:
    
            2.6.4 >= 2.5.37
    
    becoming:
    
            264 >= 2537
    
    Failing the build on flex 2.5.37, so instead use the back to the past
    added $(call version_ge3,2.6.4,$(FLEX_VERSION)) variant to check for
    that.
    
    Making sure $(FLEX_VERSION) keeps the dots as we may want to use 'sort
    -V' or something nicer when available everywhere.
    
    Signed-off-by: Ian Rogers <irogers@...gle.com>
    Cc: Adrian Hunter <adrian.hunter@...el.com>
    Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
    Cc: Andrii Nakryiko <andrii@...nel.org>
    Cc: Eduard Zingerman <eddyz87@...il.com>
    Cc: Gaosheng Cui <cuigaosheng1@...wei.com>
    Cc: Ingo Molnar <mingo@...hat.com>
    Cc: Jiri Olsa <jolsa@...nel.org>
    Cc: Kan Liang <kan.liang@...ux.intel.com>
    Cc: Mark Rutland <mark.rutland@....com>
    Cc: Namhyung Kim <namhyung@...nel.org>
    Cc: Nathan Chancellor <nathan@...nel.org>
    Cc: Nick Desaulniers <ndesaulniers@...gle.com>
    Cc: Peter Zijlstra <peterz@...radead.org>
    Cc: Rob Herring <robh@...nel.org>
    Cc: Tom Rix <trix@...hat.com>
    Cc: bpf@...r.kernel.org
    Cc: llvm@...ts.linux.dev
    Link: https://lore.kernel.org/r/20230728064917.767761-5-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index bb08149179e405ac..ae91e2786f1a4f55 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -1,3 +1,5 @@
+include $(srctree)/tools/scripts/utilities.mak
+
 perf-y += arm64-frame-pointer-unwind-support.o
 perf-y += addr_location.o
 perf-y += annotate.o
@@ -279,13 +281,11 @@ $(OUTPUT)util/bpf-filter-bison.c $(OUTPUT)util/bpf-filter-bison.h: util/bpf-filt
 	$(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \
 		-o $(OUTPUT)util/bpf-filter-bison.c -p perf_bpf_filter_
 
-FLEX_GE_26 := $(shell expr $(shell $(FLEX) --version | sed -e  's/flex \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 26)
-ifeq ($(FLEX_GE_26),1)
-  flex_flags := -Wno-switch-enum -Wno-switch-default -Wno-unused-function -Wno-redundant-decls -Wno-sign-compare -Wno-unused-parameter -Wno-missing-prototypes -Wno-missing-declarations
-  CC_HASNT_MISLEADING_INDENTATION := $(shell echo "int main(void) { return 0 }" | $(CC) -Werror -Wno-misleading-indentation -o /dev/null -xc - 2>&1 | grep -q -- -Wno-misleading-indentation ; echo $$?)
-  ifeq ($(CC_HASNT_MISLEADING_INDENTATION), 1)
-    flex_flags += -Wno-misleading-indentation
-  endif
+FLEX_VERSION := $(shell $(FLEX) --version | cut -d' ' -f2)
+
+FLEX_GE_264 := $(call version_ge3,2.6.4,$(FLEX_VERSION))
+ifeq ($(FLEX_GE_264),1)
+  flex_flags := -Wno-redundant-decls -Wno-switch-default -Wno-unused-function -Wno-misleading-indentation
 else
   flex_flags := -w
 endif

--------------------------------------------------------------------------

with version_ge3 being:

commit aa9e655a4d755c3c75eb3d200d87a3b695f602cf
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
Date:   Mon Jul 31 16:19:21 2023 -0300

    tools build: Add a 3-component greater or equal version comparator
    
    The next cset needs to compare if a flex version is greater or equal
    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.
    
    Cc: Adrian Hunter <adrian.hunter@...el.com>
    Cc: Ian Rogers <irogers@...gle.com>
    Cc: Jiri Olsa <jolsa@...nel.org>
    Cc: Namhyung Kim <namhyung@...nel.org>
    Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>

diff --git a/tools/scripts/utilities.mak b/tools/scripts/utilities.mak
index 172e47273b5d995a..568a6541ecf98075 100644
--- a/tools/scripts/utilities.mak
+++ b/tools/scripts/utilities.mak
@@ -177,3 +177,13 @@ $(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 anoter, 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 awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) >= (10000000 * $$4 + 10000 * $$5 + $$6)) }' <<< "$(1).$(2)")


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ