From: Dodji Seketeli Date: Wed, 18 Sep 2019 07:16:27 +0000 (+0200) Subject: Detect the presence of R_AARCH64_{ABS64, PREL32} macros X-Git-Tag: upstream/1.7~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce0d10da914055b759500cc017e59968d258fdbe;p=platform%2Fupstream%2Flibabigail.git 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 --- diff --git a/configure.ac b/configure.ac index 44e951f5..842dcfc9 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]]) + +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 ]]) + +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], diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 0349eee1..6af5fbcd 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -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: