All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: Make perf able to build with latest libbfd
@ 2020-01-28 15:29 Changbin Du
  2020-01-29  7:58 ` Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Changbin Du @ 2020-01-28 15:29 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: linux-kernel, Changbin Du

libbfd has changed the bfd_section_* macros to inline functions
bfd_section_<field> since 2019-09-18. See below two commits:
  o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
  o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html

This fix make perf able to build with both old and new libbfd.

Signed-off-by: Changbin Du <changbin.du@gmail.com>
---
 tools/perf/util/srcline.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 6ccf6f6d09df..5b7d6c16d33f 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
 	bfd_vma pc, vma;
 	bfd_size_type size;
 	struct a2l_data *a2l = data;
+	flagword flags;
 
 	if (a2l->found)
 		return;
 
-	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
+#ifdef bfd_get_section_flags
+	flags = bfd_get_section_flags(abfd, section);
+#else
+	flags = bfd_section_flags(section);
+#endif
+	if ((flags & SEC_ALLOC) == 0)
 		return;
 
 	pc = a2l->addr;
+#ifdef bfd_get_section_vma
 	vma = bfd_get_section_vma(abfd, section);
+#else
+	vma = bfd_section_vma(section);
+#endif
+#ifdef bfd_get_section_size
 	size = bfd_get_section_size(section);
+#else
+	size = bfd_section_size(section);
+#endif
 
 	if (pc < vma || pc >= vma + size)
 		return;
-- 
2.24.0


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

* Re: [PATCH] perf: Make perf able to build with latest libbfd
  2020-01-28 15:29 [PATCH] perf: Make perf able to build with latest libbfd Changbin Du
@ 2020-01-29  7:58 ` Jiri Olsa
  2020-01-30 10:55   ` Arnaldo Carvalho de Melo
  2020-02-05 15:45 ` [tip: perf/urgent] " tip-bot2 for Changbin Du
  2020-05-31  1:50 ` [PATCH] " Marek Vasut
  2 siblings, 1 reply; 9+ messages in thread
From: Jiri Olsa @ 2020-01-29  7:58 UTC (permalink / raw)
  To: Changbin Du
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, linux-kernel

On Tue, Jan 28, 2020 at 11:29:38PM +0800, Changbin Du wrote:
> libbfd has changed the bfd_section_* macros to inline functions
> bfd_section_<field> since 2019-09-18. See below two commits:
>   o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
>   o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
> 
> This fix make perf able to build with both old and new libbfd.
> 
> Signed-off-by: Changbin Du <changbin.du@gmail.com>

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka


> ---
>  tools/perf/util/srcline.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
> index 6ccf6f6d09df..5b7d6c16d33f 100644
> --- a/tools/perf/util/srcline.c
> +++ b/tools/perf/util/srcline.c
> @@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
>  	bfd_vma pc, vma;
>  	bfd_size_type size;
>  	struct a2l_data *a2l = data;
> +	flagword flags;
>  
>  	if (a2l->found)
>  		return;
>  
> -	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
> +#ifdef bfd_get_section_flags
> +	flags = bfd_get_section_flags(abfd, section);
> +#else
> +	flags = bfd_section_flags(section);
> +#endif
> +	if ((flags & SEC_ALLOC) == 0)
>  		return;
>  
>  	pc = a2l->addr;
> +#ifdef bfd_get_section_vma
>  	vma = bfd_get_section_vma(abfd, section);
> +#else
> +	vma = bfd_section_vma(section);
> +#endif
> +#ifdef bfd_get_section_size
>  	size = bfd_get_section_size(section);
> +#else
> +	size = bfd_section_size(section);
> +#endif
>  
>  	if (pc < vma || pc >= vma + size)
>  		return;
> -- 
> 2.24.0
> 


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

* Re: [PATCH] perf: Make perf able to build with latest libbfd
  2020-01-29  7:58 ` Jiri Olsa
@ 2020-01-30 10:55   ` Arnaldo Carvalho de Melo
  2020-02-16 23:25     ` Stephen Rothwell
  0 siblings, 1 reply; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-01-30 10:55 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: Changbin Du, Peter Zijlstra, Ingo Molnar, linux-kernel

Em Wed, Jan 29, 2020 at 08:58:29AM +0100, Jiri Olsa escreveu:
> On Tue, Jan 28, 2020 at 11:29:38PM +0800, Changbin Du wrote:
> > libbfd has changed the bfd_section_* macros to inline functions
> > bfd_section_<field> since 2019-09-18. See below two commits:
> >   o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
> >   o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
> > 
> > This fix make perf able to build with both old and new libbfd.
> > 
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks, applied.

- Arnaldo
 
> thanks,
> jirka
> 
> 
> > ---
> >  tools/perf/util/srcline.c | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
> > index 6ccf6f6d09df..5b7d6c16d33f 100644
> > --- a/tools/perf/util/srcline.c
> > +++ b/tools/perf/util/srcline.c
> > @@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
> >  	bfd_vma pc, vma;
> >  	bfd_size_type size;
> >  	struct a2l_data *a2l = data;
> > +	flagword flags;
> >  
> >  	if (a2l->found)
> >  		return;
> >  
> > -	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
> > +#ifdef bfd_get_section_flags
> > +	flags = bfd_get_section_flags(abfd, section);
> > +#else
> > +	flags = bfd_section_flags(section);
> > +#endif
> > +	if ((flags & SEC_ALLOC) == 0)
> >  		return;
> >  
> >  	pc = a2l->addr;
> > +#ifdef bfd_get_section_vma
> >  	vma = bfd_get_section_vma(abfd, section);
> > +#else
> > +	vma = bfd_section_vma(section);
> > +#endif
> > +#ifdef bfd_get_section_size
> >  	size = bfd_get_section_size(section);
> > +#else
> > +	size = bfd_section_size(section);
> > +#endif
> >  
> >  	if (pc < vma || pc >= vma + size)
> >  		return;
> > -- 
> > 2.24.0
> > 
> 

-- 

- Arnaldo

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

* [tip: perf/urgent] perf: Make perf able to build with latest libbfd
  2020-01-28 15:29 [PATCH] perf: Make perf able to build with latest libbfd Changbin Du
  2020-01-29  7:58 ` Jiri Olsa
@ 2020-02-05 15:45 ` tip-bot2 for Changbin Du
  2020-05-31  1:50 ` [PATCH] " Marek Vasut
  2 siblings, 0 replies; 9+ messages in thread
From: tip-bot2 for Changbin Du @ 2020-02-05 15:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Changbin Du, Jiri Olsa, Peter Zijlstra, Arnaldo Carvalho de Melo,
	x86, LKML

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     0ada120c883d4f1f6aafd01cf0fbb10d8bbba015
Gitweb:        https://git.kernel.org/tip/0ada120c883d4f1f6aafd01cf0fbb10d8bbba015
Author:        Changbin Du <changbin.du@gmail.com>
AuthorDate:    Tue, 28 Jan 2020 23:29:38 +08:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Thu, 30 Jan 2020 11:55:26 +01:00

perf: Make perf able to build with latest libbfd

libbfd has changed the bfd_section_* macros to inline functions
bfd_section_<field> since 2019-09-18. See below two commits:
  o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
  o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html

This fix make perf able to build with both old and new libbfd.

Signed-off-by: Changbin Du <changbin.du@gmail.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200128152938.31413-1-changbin.du@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/srcline.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 6ccf6f6..5b7d6c1 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
 	bfd_vma pc, vma;
 	bfd_size_type size;
 	struct a2l_data *a2l = data;
+	flagword flags;
 
 	if (a2l->found)
 		return;
 
-	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
+#ifdef bfd_get_section_flags
+	flags = bfd_get_section_flags(abfd, section);
+#else
+	flags = bfd_section_flags(section);
+#endif
+	if ((flags & SEC_ALLOC) == 0)
 		return;
 
 	pc = a2l->addr;
+#ifdef bfd_get_section_vma
 	vma = bfd_get_section_vma(abfd, section);
+#else
+	vma = bfd_section_vma(section);
+#endif
+#ifdef bfd_get_section_size
 	size = bfd_get_section_size(section);
+#else
+	size = bfd_section_size(section);
+#endif
 
 	if (pc < vma || pc >= vma + size)
 		return;

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

* Re: [PATCH] perf: Make perf able to build with latest libbfd
  2020-01-30 10:55   ` Arnaldo Carvalho de Melo
@ 2020-02-16 23:25     ` Stephen Rothwell
  2020-05-01  0:17       ` Joel Stanley
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2020-02-16 23:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Changbin Du, Peter Zijlstra, Ingo Molnar, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

Hi Arnaldo,

On Thu, 30 Jan 2020 11:55:48 +0100 Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
>
> Em Wed, Jan 29, 2020 at 08:58:29AM +0100, Jiri Olsa escreveu:
> > On Tue, Jan 28, 2020 at 11:29:38PM +0800, Changbin Du wrote:  
> > > libbfd has changed the bfd_section_* macros to inline functions
> > > bfd_section_<field> since 2019-09-18. See below two commits:
> > >   o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
> > >   o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
> > > 
> > > This fix make perf able to build with both old and new libbfd.
> > > 
> > > Signed-off-by: Changbin Du <changbin.du@gmail.com>  
> > 
> > Acked-by: Jiri Olsa <jolsa@redhat.com>  
> 
> Thanks, applied.

Just wondering if this should have been cc'd to stable?
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] perf: Make perf able to build with latest libbfd
  2020-02-16 23:25     ` Stephen Rothwell
@ 2020-05-01  0:17       ` Joel Stanley
  0 siblings, 0 replies; 9+ messages in thread
From: Joel Stanley @ 2020-05-01  0:17 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Changbin Du, Peter Zijlstra,
	Ingo Molnar, Linux Kernel Mailing List

On Sun, 16 Feb 2020 at 23:25, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi Arnaldo,
>
> On Thu, 30 Jan 2020 11:55:48 +0100 Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote:
> >
> > Em Wed, Jan 29, 2020 at 08:58:29AM +0100, Jiri Olsa escreveu:
> > > On Tue, Jan 28, 2020 at 11:29:38PM +0800, Changbin Du wrote:
> > > > libbfd has changed the bfd_section_* macros to inline functions
> > > > bfd_section_<field> since 2019-09-18. See below two commits:
> > > >   o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
> > > >   o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
> > > >
> > > > This fix make perf able to build with both old and new libbfd.
> > > >
> > > > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > >
> > > Acked-by: Jiri Olsa <jolsa@redhat.com>
> >
> > Thanks, applied.
>
> Just wondering if this should have been cc'd to stable?

Yes please. We hit this today.

Cheers,

Joel

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

* Re: [PATCH] perf: Make perf able to build with latest libbfd
  2020-01-28 15:29 [PATCH] perf: Make perf able to build with latest libbfd Changbin Du
  2020-01-29  7:58 ` Jiri Olsa
  2020-02-05 15:45 ` [tip: perf/urgent] " tip-bot2 for Changbin Du
@ 2020-05-31  1:50 ` Marek Vasut
  2020-06-01 16:47   ` Greg KH
  2 siblings, 1 reply; 9+ messages in thread
From: Marek Vasut @ 2020-05-31  1:50 UTC (permalink / raw)
  To: changbin.du, linux-stable; +Cc: acme, jolsa, linux-kernel, mingo, peterz

Hi,

since commit
0ada120c883d ("perf: Make perf able to build with latest libbfd")
is in master, can it be backported to stable as well? I keep hitting
this with too new binutils on Linux 5.4.y and I have to keep
cherry-picking this commit to fix it.

Thanks

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

* Re: [PATCH] perf: Make perf able to build with latest libbfd
  2020-05-31  1:50 ` [PATCH] " Marek Vasut
@ 2020-06-01 16:47   ` Greg KH
       [not found]     ` <46FC68D5-0AB5-45F7-8851-555779C5685F@iscas.ac.cn>
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2020-06-01 16:47 UTC (permalink / raw)
  To: Marek Vasut
  Cc: changbin.du, linux-stable, acme, jolsa, linux-kernel, mingo, peterz

On Sun, May 31, 2020 at 03:50:25AM +0200, Marek Vasut wrote:
> Hi,
> 
> since commit
> 0ada120c883d ("perf: Make perf able to build with latest libbfd")
> is in master, can it be backported to stable as well? I keep hitting
> this with too new binutils on Linux 5.4.y and I have to keep
> cherry-picking this commit to fix it.

Now applied, thanks.

greg k-h

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

* Re: [PATCH] perf: Make perf able to build with latest libbfd
       [not found]     ` <46FC68D5-0AB5-45F7-8851-555779C5685F@iscas.ac.cn>
@ 2020-07-16 12:01       ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2020-07-16 12:01 UTC (permalink / raw)
  To: Jianmin Wang
  Cc: Marek Vasut, changbin.du, linux-stable, acme, jolsa,
	linux-kernel, mingo, peterz

On Thu, Jul 16, 2020 at 10:07:15AM +0800, Jianmin Wang wrote:
> Hi, Greg KH,
> 
> There is the same problem found on Linux 4.19.y, while compiling linux 4.19.y
> with binutils 2.34.
> 
> Can the follow commit be backported to stable branch 4.19.y as well?
> 
> Commit id: 0ada120c883d ("perf: Make perf able to build with latest libbfd")

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2020-07-16 12:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 15:29 [PATCH] perf: Make perf able to build with latest libbfd Changbin Du
2020-01-29  7:58 ` Jiri Olsa
2020-01-30 10:55   ` Arnaldo Carvalho de Melo
2020-02-16 23:25     ` Stephen Rothwell
2020-05-01  0:17       ` Joel Stanley
2020-02-05 15:45 ` [tip: perf/urgent] " tip-bot2 for Changbin Du
2020-05-31  1:50 ` [PATCH] " Marek Vasut
2020-06-01 16:47   ` Greg KH
     [not found]     ` <46FC68D5-0AB5-45F7-8851-555779C5685F@iscas.ac.cn>
2020-07-16 12:01       ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.