public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, committed] ce0d10d Detect the presence of R_AARCH64_{ABS64, PREL32} macros
@ 2019-01-01  0:00 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2019-01-01  0:00 UTC (permalink / raw)
  To: libabigail

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]

Hello,

There was a build failure on the EL6 platform, reported by the
autobuilder at https://jenkins-fedora-infra.apps.ci.centos.org/job/libabigail/label=EL6/647/console.

The exact root error was:

    ../../src/abg-dwarf-reader.cc:7649: error: ‘R_AARCH64_ABS64’ was not declared in this scope
    ../../src/abg-dwarf-reader.cc:7653: error: ‘R_AARCH64_PREL32’ was not declared in this scope

This is due to the recent patch:

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

which (rightfully) introduces the use of the R_AARCH64_{ABS64, PREL32}
macros that are defined in the "elf.h" system header.  Unfortunately,
older versions of that system header don't define those macros.

I have thus committed the patch below to have the configure system
detect the presence of these macros and avoid using them if they are not
present.

Cheers,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: the patch --]
[-- Type: text/x-patch, Size: 2970 bytes --]

From ce0d10da914055b759500cc017e59968d258fdbe Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji@redhat.com>
Date: Wed, 18 Sep 2019 09:16:27 +0200
Subject: [PATCH] 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>
---
 configure.ac            | 24 ++++++++++++++++++++++++
 src/abg-dwarf-reader.cc |  4 ++++
 2 files changed, 28 insertions(+)

diff --git a/configure.ac b/configure.ac
index 44e951f..842dcfc 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 <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],
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 0349eee..6af5fbc 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:
-- 
1.8.3.1


[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
		Dodji

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-18  7:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [PATCH, committed] ce0d10d Detect the presence of R_AARCH64_{ABS64, PREL32} macros Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).