CMake: Add BFD, support new BFD API

This commit is contained in:
Jonathan G Rennison
2020-06-28 13:59:53 +01:00
parent 378a405b0c
commit 10aab3e3a3
4 changed files with 85 additions and 1 deletions

View File

@@ -853,7 +853,7 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
bfd_vma vma = bfd_get_section_vma(abfd, section);
if (info->addr < vma) return;
bfd_size_type size = bfd_section_size(abfd, section);
bfd_size_type size = get_bfd_section_size(abfd, section);
if (info->addr >= vma + size) return;
info->found = bfd_find_nearest_line(abfd, section, info->syms, info->addr - vma,

View File

@@ -10,6 +10,16 @@
#ifndef CRASHLOG_BFD_H
#define CRASHLOG_BFD_H
#if defined(WITH_BFD0)
#define WITH_BFD 1
#define get_bfd_section_size(abfd, section) bfd_section_size(abfd, section)
#elif defined(WITH_BFD1)
#define WITH_BFD 1
#define bfd_get_section_flags(abfd, section) bfd_section_flags(section)
#define bfd_get_section_vma(abfd, section) bfd_section_vma(section)
#define get_bfd_section_size(abfd, section) bfd_section_size(section)
#endif
#if defined(WITH_BFD)
/* this is because newer versions of libbfd insist on seeing these, even though they aren't used for anything */
#define PACKAGE 1