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

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.