[SymbolInfo.cc] Support compilation with binutils >= 2.33.1 on Debian.

bfd_get_section_vma macro was removed.
bfd_section_size changed signature.

See inline comment for details.
pull/299/head
Giuseppe Corbelli 2020-01-14 11:50:20 +01:00
parent a3cce71643
commit b4d6ac055f
1 changed files with 21 additions and 14 deletions

View File

@ -118,13 +118,20 @@ void SymbolInfo::BacktraceInfo::Callback( bfd *abfd, asection *section,
if ((section->flags & SEC_ALLOC) == 0)
return ;
bfd_vma vma = bfd_get_section_vma(abfd, section);
// bfd_get_section_vma works up to 7b1cfbcf1a27951fb1b3a212995075dd6fdf985b,
// removed in 7c13bc8c91abf291f0206b6608b31955c5ea70d8 (binutils 2.33.1 or so)
// so it's substituted by its implementation to avoid checking for binutils
// version (which at least on Debian SID it's not that easy because the
// version.h is not included with the official package)
bfd_vma vma = section->vma;
unsigned long address = (unsigned long)(info->m_addr);
if ( address < vma )
return;
bfd_size_type size = bfd_section_size(abfd, section);
// bfd_section_size changed between the two objects described above,
// same rationale applies
bfd_size_type size = section->size;
if ( address > (vma + size))
return ;