Detect the presence of R_AARCH64_{ABS64, PREL32} macros

The patch:

 "e687032 Support pre and post v4.19 ksymtabs for Linux kernel modules"

introduces the use of the R_AARCH64_{ABS64, PREL32} macros.  However,
some older "elf.h" don't define these.  When compiling on these older
platforms, we thus need to avoid using these new macros.

With this patch, the configure system detects the presence of these
macros and defines the HAVE_R_AARCH64_{ABS64, PREL32}_MACRO macros
accordingly.

Note that just to comply with what's in there in the code already, we
don't directly do "#ifdef R_AARCH64_ABS64", but rather "#ifdef
HAVE_R_AARCH64_ABS64_MACRO", to allow cases where we want to
artificially disable the "feature" at configure time, in the future.

	* configure.ac: Define macros HAVE_R_AARCH64_{ABS64, PREL32}_MACRO
	if the macros R_AARCH64_{ABS64, PREL32} are present.
	* src/abg-dwarf-reader.cc
	(read_context::get_ksymtab_format_module): Conditionalize the use
	of R_AARCH64_{ABS64, PREL32} using HAVE_R_AARCH64_{ABS64, PREL32}_MACRO.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2019-09-18 09:16:27 +02:00
parent e6870326e0
commit ce0d10da91
2 changed files with 28 additions and 0 deletions

View File

@ -646,6 +646,30 @@ if test x$HAS_EM_TILEGX = xyes; then
[Defined to 1 if elf.h has EM_TILEGX macro defined])
fi
HAS_R_AARCH64_ABS64=no
AC_CHECK_DECL([R_AARCH64_ABS64],
[HAS_R_AARCH64_ABS64=yes],
[HAS_R_AARCH64_ABS64=no],
[[#include <elf.h>]])
if test x$HAS_R_AARCH64_ABS64 = xyes; then
AC_DEFINE([HAVE_R_AARCH64_ABS64_MACRO],
1,
[Defined to 1 if elf.h has R_AARCH64_ABS64 macro defined])
fi
HAS_R_AARCH64_PREL32=no
AC_CHECK_DECL([R_AARCH64_PREL32],
[HAS_R_AARCH64_PREL32=yes],
[HAS_R_AARCH64_PREL32=no],
[[#include <elf.h>]])
if test x$HAS_R_AARCH64_PREL32 = xyes; then
AC_DEFINE([HAVE_R_AARCH64_PREL32_MACRO],
1,
[Defined to 1 if elf.h has R_AARCH64_PREL32 macro defined])
fi
HAS_DW_LANG_UPC=no
AC_CHECK_DECL([DW_LANG_UPC],
[HAS_DW_LANG_UPC=yes],

View File

@ -7646,11 +7646,15 @@ public:
switch (type)
{
case R_X86_64_64: // Same as R_386_32, fallthrough
#ifdef HAVE_R_AARCH64_ABS64_MACRO
case R_AARCH64_ABS64:
#endif
format = PRE_V4_19_KSYMTAB_FORMAT;
break;
case R_X86_64_PC32: // Same as R_386_PC32, fallthrough
#ifdef HAVE_R_AARCH64_PREL32_MACRO
case R_AARCH64_PREL32:
#endif
format = V4_19_KSYMTAB_FORMAT;
break;
default: