Skip to contentSkip to conversation

perf: Use (long) for iterator for bfd symbols

PATCH Applied Dmitry Safonov 3 participants 3 messages Feb 9, 2021 – Feb 11, 2021 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Use (long) for iterator for bfd symbols

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 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")
Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jacek Caban <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Remi Bernon <[email protected]>
---
 tools/perf/util/symbol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/symbol.c +1 -2
index 64a039cbba1b..1645fb4ec9ed 100644
@@ -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);
Signature · 1 line
2.30.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hello,

Quoted 18 lines · Dmitry Safonov

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 oneliner and as perf has CORE_CFLAGS += -Wextra, which makes build to fail together with CORE_CFLAGS += -Werror

Quoted 11 lines
Fixes eac9a4342e54 ("perf symbols: Try reading the symbol table with libbfd")
Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jacek Caban <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Remi Bernon <[email protected]>

Thanks,
Namhyung

Quoted 25 lines
---
 tools/perf/util/symbol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/symbol.c +1 -3
index 64a039cbba1b..1645fb4ec9ed 100644
@@ -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.30.0

maintainer Applied
#2 lore raw

Em Thu, Feb 11, 2021 at 06:14:03PM +0900, Namhyung Kim escreveu:

Quoted 33 lines

Hello,

Quoted 18 lines · Dmitry Safonov

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 oneliner and as perf has CORE_CFLAGS += -Wextra, which makes build to fail together with CORE_CFLAGS += -Werror

Quoted 11 lines
Fixes eac9a4342e54 ("perf symbols: Try reading the symbol table with libbfd")
Cc Alexander Shishkin <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jacek Caban <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Remi Bernon <[email protected]>
Quoted 1 line

Thanks, applied.

- Arnaldo

Quoted 29 lines

Thanks,
Namhyung

Quoted 25 lines
---
 tools/perf/util/symbol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/symbol.c +1 -3
index 64a039cbba1b..1645fb4ec9ed 100644
@@ -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.30.0

Signature · 1 line
- Arnaldo