From: Dmitry Safonov <d...@arista.com>

[ Upstream commit 96de68fff5ded8833bf5832658cb43c54f86ff6c ]

GCC (GCC) 8.4.0 20200304 fails to build perf with:
: util/symbol.c: In function 'dso__load_bfd_symbols':
: util/symbol.c:1626:16: error: comparison of integer expressions of different 
signednes
:   for (i = 0; i < symbols_count; ++i) {
:                 ^
: util/symbol.c:1632:16: error: comparison of integer expressions of different 
signednes
:    while (i + 1 < symbols_count &&
:                 ^
: util/symbol.c:1637:13: error: comparison of integer expressions of different 
signednes
:    if (i + 1 < symbols_count &&
:              ^
: cc1: all warnings being treated as errors

It's unlikely that the symtable will be that big, but the fix is an
oneliner and as perf has CORE_CFLAGS += -Wextra, which makes build to
fail together with CORE_CFLAGS += -Werror

Fixes: eac9a4342e54 ("perf symbols: Try reading the symbol table with libbfd")
Signed-off-by: Dmitry Safonov <d...@arista.com>
Acked-by: Namhyung Kim <namhy...@kernel.org>
Cc: Alexander Shishkin <alexander.shish...@linux.intel.com>
Cc: Dmitry Safonov <0x7f454...@gmail.com>
Cc: Jacek Caban <ja...@codeweavers.com>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Mark Rutland <mark.rutl...@arm.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Remi Bernon <rber...@codeweavers.com>
Link: http://lore.kernel.org/lkml/20210209145148.178702-1-d...@arista.com
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 tools/perf/util/symbol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0d14abdf3d722..da6036ba0cea4 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1561,12 +1561,11 @@ static int bfd2elf_binding(asymbol *symbol)
 int dso__load_bfd_symbols(struct dso *dso, const char *debugfile)
 {
        int err = -1;
-       long symbols_size, symbols_count;
+       long symbols_size, symbols_count, i;
        asection *section;
        asymbol **symbols, *sym;
        struct symbol *symbol;
        bfd *abfd;
-       u_int i;
        u64 start, len;
 
        abfd = bfd_openr(dso->long_name, NULL);
-- 
2.27.0



Reply via email to