Skip to content

Commit

Permalink
Updating to support binutils 2.34 API changes, adding pthread.h inclu…
Browse files Browse the repository at this point in the history
…de header where needed
  • Loading branch information
khuck committed Jul 17, 2020
1 parent c59fac9 commit 0398c1f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/apex/apex_bfd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@
#include <psapi.h>
#endif

/* When BFD 2.34 was released, some API calls were replaced. */
#if !defined(bfd_get_section)
#define TAU_BFD_GET_SECTION_FLAGS(_abfd, _section) bfd_section_flags(_section)
#define TAU_BFD_GET_SECTION_VMA(_abfd, _section) bfd_section_vma(_section)
#define TAU_BFD_GET_SECTION_SIZE(_section) bfd_section_size(_section)
#define TAU_BFD_GET_SECTION(_symbol) bfd_asymbol_section(_symbol)
#else
#define TAU_BFD_GET_SECTION_FLAGS(_abfd, _section) bfd_get_section_flags(_abfd, _section)
#define TAU_BFD_GET_SECTION_VMA(_abfd, _section) bfd_get_section_vma(_abfd, _section)
#define TAU_BFD_GET_SECTION_SIZE(_section) bfd_get_section_size(_section)
#define TAU_BFD_GET_SECTION(_symbol) bfd_get_section(_symbol)
#endif

using namespace std;

char const * Apex_bfd_internal_getExecutablePath();
Expand Down Expand Up @@ -988,14 +1001,14 @@ void Apex_bfd_internal_locateAddress(bfd * bfdptr,
if (data.found) return;

// Skip this section if it isn't a debug info section
if ((bfd_get_section_flags(bfdptr, section) & SEC_ALLOC) == 0) return;
if ((TAU_BFD_GET_SECTION_FLAGS(bfdptr, section) & SEC_ALLOC) == 0) return;

// Skip this section if the address is before the section start
bfd_vma vma = bfd_get_section_vma(bfdptr, section);
bfd_vma vma = TAU_BFD_GET_SECTION_VMA(bfdptr, section);
if (data.info.probeAddr < vma) return;

// Skip this section if the address is after the section end
bfd_size_type size = bfd_get_section_size(section);
bfd_size_type size = TAU_BFD_GET_SECTION_SIZE(section);
if (data.info.probeAddr >= vma + size) return;

// The section contains this address, so try to resolve info
Expand Down
2 changes: 2 additions & 0 deletions src/wrappers/pthread_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define _GNU_SOURCE
#endif

#include <pthread.h>

#if !defined(__APPLE__)
#define APEX_PTHREAD_BARRIER_AVAILABLE
#endif
Expand Down

0 comments on commit 0398c1f

Please sign in to comment.