Changes to detect that bfd_get_section_vma has changed to bfd_section_vma and make corresponding changes so we can support use of binutils 2.34 and later.

This commit is contained in:
Richard Frith-Macdonald 2021-03-18 21:35:34 +00:00
parent 4e61056743
commit b489f9b82b
4 changed files with 64 additions and 12 deletions

View file

@ -183,6 +183,9 @@
/* Define to 1 if you have the <bfd.h> header file. */
#undef HAVE_BFD_H
/* Have bfd_section_vma */
#undef HAVE_BFD_SECTION_VMA
/* Define to 1 if you have the <callback.h> header file. */
#undef HAVE_CALLBACK_H

View file

@ -416,25 +416,33 @@ static void find_address (bfd *abfd, asection *section,
{
return;
}
if (!(bfd_get_section_flags (abfd, section) & SEC_ALLOC))
address = (bfd_vma) (uintptr_t)info->theAddress;
/* bfd_get_section_vma() was changed to bfd_section_vma() together with
* changes to a couple of other inline functions.
*/
#if defined(HAVE_BFD_SECTION_VMA)
if (!(bfd_section_flags(section) & SEC_ALLOC))
{
return; // Only debug in this section
}
if (bfd_get_section_flags (abfd, section) & SEC_DATA)
if (bfd_section_flags(section) & SEC_DATA)
{
return; // Only data in this section
}
address = (bfd_vma) (uintptr_t)info->theAddress;
vma = bfd_get_section_vma (abfd, section);
#if defined(bfd_get_section_size_before_reloc)
size = bfd_get_section_size_before_reloc (section); // recent
#elif defined(bfd_get_section_size)
size = bfd_get_section_size (section); // less recent
vma = bfd_section_vma(section);
size = bfd_section_size(section);
#else
size = bfd_section_size (abfd, section); // older version
if (!(bfd_get_section_flags(abfd, section) & SEC_ALLOC))
{
return; // Only debug in this section
}
if (bfd_get_section_flags(abfd, section) & SEC_DATA)
{
return; // Only data in this section
}
vma = bfd_get_section_vma(abfd, section);
size = bfd_section_size(abfd, section);
#endif
if (address < vma || address >= vma + size)

29
configure vendored
View file

@ -9129,6 +9129,35 @@ _ACEOF
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <bfd.h>
int
main ()
{
bfd_section_vma(0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bfd_section_vma=1
else
bfd_section_vma=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $bfd_section_vma = 1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: bfd_section_vma found" >&5
$as_echo "bfd_section_vma found" >&6; }
$as_echo "#define HAVE_BFD_SECTION_VMA 1" >>confdefs.h
fi
if test $ismingw = yes ; then
for ac_header in dbghelp.h
do :

View file

@ -2357,6 +2357,18 @@ AC_CHECK_HEADERS(bfd.h)
AC_CHECK_LIB(intl, libintl_fprintf)
AC_CHECK_LIB(iberty, dyn_string_append)
AC_CHECK_LIB(bfd, bfd_openr)
AC_TRY_COMPILE([
#include <bfd.h>
],
[bfd_section_vma(0);],
bfd_section_vma=1, bfd_section_vma=0)
if test $bfd_section_vma = 1; then
AC_MSG_RESULT([bfd_section_vma found])
AC_DEFINE([HAVE_BFD_SECTION_VMA], [1], [Have bfd_section_vma])
fi
if test $ismingw = yes ; then
AC_CHECK_HEADERS(dbghelp.h)
else