This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] [AArch64] Skip IFUNC relocations in debug sections
- From: Szabolcs Nagy <nsz at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 17 Aug 2017 13:49:33 -0000
- Subject: [binutils-gdb] [AArch64] Skip IFUNC relocations in debug sections
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=545bc2b377db80aa6edd0cf00cde6f963735f8d1
commit 545bc2b377db80aa6edd0cf00cde6f963735f8d1
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Thu Aug 17 14:48:03 2017 +0100
[AArch64] Skip IFUNC relocations in debug sections
Skip IFUNC relocations in debug sections ignored by ld.so.
Fixes the following ld test failures on aarch64:
FAIL: Build libpr18808.so
FAIL: Build libpr18808.so_2
FAIL: Run pr18808
aborting at bfd/elfnn-aarch64.c:4986 in elf64_aarch64_final_link_relocate.
bfd/
PR ld/18808
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC
relocations in debug sections, change abort to _bfd_error_handler.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elfnn-aarch64.c | 25 ++++++++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 914c10d..e1985a4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-17 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ PR ld/18808
+ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC
+ relocations in debug sections, change abort to _bfd_error_handler.
+
2017-08-14 Nick Clifton <nickc@redhat.com>
PR 21957
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 0d8332e..796fe1f 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -4981,9 +4981,27 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
const char *name;
bfd_vma addend = 0;
- if ((input_section->flags & SEC_ALLOC) == 0
- || h->plt.offset == (bfd_vma) -1)
- abort ();
+ if ((input_section->flags & SEC_ALLOC) == 0)
+ {
+ /* Dynamic relocs are not propagated for SEC_DEBUGGING
+ sections because such sections are not SEC_ALLOC and
+ thus ld.so will not process them. */
+ if ((input_section->flags & SEC_DEBUGGING) != 0)
+ return bfd_reloc_ok;
+
+ if (h->root.root.string)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, NULL);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B(%A+%#Lx): unresolvable %s relocation against symbol `%s'"),
+ input_bfd, input_section, rel->r_offset, howto->name, name);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ else if (h->plt.offset == (bfd_vma) -1)
+ goto bad_ifunc_reloc;
/* STT_GNU_IFUNC symbol must go through PLT. */
plt = globals->root.splt ? globals->root.splt : globals->root.iplt;
@@ -4992,6 +5010,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
switch (bfd_r_type)
{
default:
+bad_ifunc_reloc:
if (h->root.root.string)
name = h->root.root.string;
else