[PATCH 1/1] perf build: Avoid false positive with -Werror=format-overflow= with gcc 10.3.0 on powerpc
From: Arnaldo Carvalho de Melo
Date: Fri Sep 02 2022 - 13:35:26 EST
When building with gcc 10.3.0 on powerpc this is happening:
75 8.89 ubuntu:20.04-x-powerpc64el : FAIL gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04)
inlined from 'branch_type_stat_display' at util/branch.c:152:4:
/usr/powerpc64le-linux-gnu/include/bits/stdio2.h:100:10: error: '%8s' directive argument is null [-Werror=format-overflow=]
100 | return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Looks related to:
[10/11/12/13 Regression] false positive: directive argument is null [-Werror=format-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90036
So lets disable this just for the util/branch.o file.
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx>
Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: James Clark <james.clark@xxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Robin Murphy <robin.murphy@xxxxxxx>
Cc: Suzuki Poulouse <suzuki.poulose@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Link: http://lore.kernel.org/lkml/YxI99uLvpgAZjm2r@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/Build | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 8fd6dc8de5210336..20a5524e88a04d44 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -223,6 +223,10 @@ CFLAGS_llvm-utils.o += -DPERF_INCLUDE_DIR="BUILD_STR($(perf_include_dir_SQ))"
# avoid compiler warnings in 32-bit mode
CFLAGS_genelf_debug.o += -Wno-packed
+# avoid false positive when building with gcc 10.3.0 on powerpc
+# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90036
+CFLAGS_branch.o += -Wno-format-overflow
+
$(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-flex.h: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
$(call rule_mkdir)
$(Q)$(call echo-cmd,flex)$(FLEX) -o $(OUTPUT)util/parse-events-flex.c \
--
2.37.2