File perf-make-perf-able-to-build-with-latest-libbfd.patch of Package perf
61
1
From: Changbin Du <changbin.du@gmail.com>
2
Date: Tue, 28 Jan 2020 23:29:38 +0800
3
Subject: perf: Make perf able to build with latest libbfd
4
Git-commit: 0ada120c883d4f1f6aafd01cf0fbb10d8bbba015
5
References: git-fixes
6
7
libbfd has changed the bfd_section_* macros to inline functions
8
bfd_section_<field> since 2019-09-18. See below two commits:
9
o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html
10
o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html
11
12
This fix make perf able to build with both old and new libbfd.
13
14
Signed-off-by: Changbin Du <changbin.du@gmail.com>
15
Acked-by: Jiri Olsa <jolsa@redhat.com>
16
Cc: Peter Zijlstra <peterz@infradead.org>
17
Link: http://lore.kernel.org/lkml/20200128152938.31413-1-changbin.du@gmail.com
18
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
19
Acked-by: Tony Jones <tonyj@suse.de>
20
---
21
tools/perf/util/srcline.c | 16 +++++++++++++++-
22
1 file changed, 15 insertions(+), 1 deletion(-)
23
24
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
25
index 6ccf6f6d09df..5b7d6c16d33f 100644
26
--- a/tools/perf/util/srcline.c
27
+++ b/tools/perf/util/srcline.c
28
29
bfd_vma pc, vma;
30
bfd_size_type size;
31
struct a2l_data *a2l = data;
32
+ flagword flags;
33
34
if (a2l->found)
35
return;
36
37
- if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
38
+#ifdef bfd_get_section_flags
39
+ flags = bfd_get_section_flags(abfd, section);
40
+#else
41
+ flags = bfd_section_flags(section);
42
+#endif
43
+ if ((flags & SEC_ALLOC) == 0)
44
return;
45
46
pc = a2l->addr;
47
+#ifdef bfd_get_section_vma
48
vma = bfd_get_section_vma(abfd, section);
49
+#else
50
+ vma = bfd_section_vma(section);
51
+#endif
52
+#ifdef bfd_get_section_size
53
size = bfd_get_section_size(section);
54
+#else
55
+ size = bfd_section_size(section);
56
+#endif
57
58
if (pc < vma || pc >= vma + size)
59
return;
60
61