linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: Use (long) for iterator for bfd symbols
@ 2021-02-09 14:51 Dmitry Safonov
  2021-02-11  9:14 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Safonov @ 2021-02-09 14:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Safonov, Dmitry Safonov, Alexander Shishkin,
	Arnaldo Carvalho de Melo, Ingo Molnar, Jacek Caban, Jiri Olsa,
	Mark Rutland, Namhyung Kim, Peter Zijlstra, Remi Bernon

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 <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jacek Caban <jacek@codeweavers.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Remi Bernon <rbernon@codeweavers.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 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 64a039cbba1b..1645fb4ec9ed 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.30.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf: Use (long) for iterator for bfd symbols
  2021-02-09 14:51 [PATCH] perf: Use (long) for iterator for bfd symbols Dmitry Safonov
@ 2021-02-11  9:14 ` Namhyung Kim
  2021-02-11 23:52   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2021-02-11  9:14 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: linux-kernel, Dmitry Safonov, Alexander Shishkin,
	Arnaldo Carvalho de Melo, Ingo Molnar, Jacek Caban, Jiri Olsa,
	Mark Rutland, Peter Zijlstra, Remi Bernon

Hello,

On Tue, Feb 9, 2021 at 11:51 PM Dmitry Safonov <dima@arista.com> wrote:
>
> 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 <alexander.shishkin@linux.intel.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jacek Caban <jacek@codeweavers.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Remi Bernon <rbernon@codeweavers.com>
> Signed-off-by: Dmitry Safonov <dima@arista.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>  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 64a039cbba1b..1645fb4ec9ed 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.30.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf: Use (long) for iterator for bfd symbols
  2021-02-11  9:14 ` Namhyung Kim
@ 2021-02-11 23:52   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-02-11 23:52 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Dmitry Safonov, linux-kernel, Dmitry Safonov, Alexander Shishkin,
	Ingo Molnar, Jacek Caban, Jiri Olsa, Mark Rutland,
	Peter Zijlstra, Remi Bernon

Em Thu, Feb 11, 2021 at 06:14:03PM +0900, Namhyung Kim escreveu:
> Hello,
> 
> On Tue, Feb 9, 2021 at 11:51 PM Dmitry Safonov <dima@arista.com> wrote:
> >
> > 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 <alexander.shishkin@linux.intel.com>
> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Jacek Caban <jacek@codeweavers.com>
> > Cc: Jiri Olsa <jolsa@redhat.com>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Remi Bernon <rbernon@codeweavers.com>
> > Signed-off-by: Dmitry Safonov <dima@arista.com>
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks, applied.

- Arnaldo

 
> Thanks,
> Namhyung
> 
> 
> > ---
> >  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 64a039cbba1b..1645fb4ec9ed 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.30.0
> >

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-11 23:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 14:51 [PATCH] perf: Use (long) for iterator for bfd symbols Dmitry Safonov
2021-02-11  9:14 ` Namhyung Kim
2021-02-11 23:52   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).