[common] fix build for newer versions of binutils

binutils has changed several macros. Added ifdef to allow building with
stable and bleeding edge versions.

refs #232
This commit is contained in:
chrsm 2020-02-22 12:48:33 -08:00 committed by Geoffrey McRae
parent 582ed6b5d1
commit 2440272307

View File

@ -98,10 +98,18 @@ static void load_symbols()
static bool lookup_address(bfd_vma pc, const char ** filename, const char ** function, unsigned int * line, unsigned int * discriminator) static bool lookup_address(bfd_vma pc, const char ** filename, const char ** function, unsigned int * line, unsigned int * discriminator)
{ {
#ifdef bfd_get_section_flags
if ((bfd_get_section_flags(crash.fd, crash.section) & SEC_ALLOC) == 0) if ((bfd_get_section_flags(crash.fd, crash.section) & SEC_ALLOC) == 0)
#else
if ((bfd_section_flags(crash.section) & SEC_ALLOC) == 0)
#endif
return false; return false;
#ifdef bfd_get_section_size
bfd_size_type size = bfd_get_section_size(crash.section); bfd_size_type size = bfd_get_section_size(crash.section);
#else
bfd_size_type size = bfd_section_size(crash.section);
#endif
if (pc >= size) if (pc >= size)
return false; return false;