Skip to content

Commit 0ada120

Browse files
changbinduacmel
authored andcommitted
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 <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 0dd1979 commit 0ada120

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tools/perf/util/srcline.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
193193
bfd_vma pc, vma;
194194
bfd_size_type size;
195195
struct a2l_data *a2l = data;
196+
flagword flags;
196197

197198
if (a2l->found)
198199
return;
199200

200-
if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
201+
#ifdef bfd_get_section_flags
202+
flags = bfd_get_section_flags(abfd, section);
203+
#else
204+
flags = bfd_section_flags(section);
205+
#endif
206+
if ((flags & SEC_ALLOC) == 0)
201207
return;
202208

203209
pc = a2l->addr;
210+
#ifdef bfd_get_section_vma
204211
vma = bfd_get_section_vma(abfd, section);
212+
#else
213+
vma = bfd_section_vma(section);
214+
#endif
215+
#ifdef bfd_get_section_size
205216
size = bfd_get_section_size(section);
217+
#else
218+
size = bfd_section_size(section);
219+
#endif
206220

207221
if (pc < vma || pc >= vma + size)
208222
return;

0 commit comments

Comments
 (0)