aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-aarch64.c
diff options
context:
space:
mode:
authorWill Newton <will.newton@linaro.org>2013-11-25 14:44:59 +0000
committerWill Newton <will.newton@linaro.org>2013-11-26 15:25:11 +0000
commit4920638856fd2ee27d0f61330e75a05b8d719f02 (patch)
tree1e6e113e384be1311b35d9307fefc4877e860fad /bfd/elfnn-aarch64.c
parentb1ee0cc48909c2116709038e6e1f2ffa7c3bd99c (diff)
downloadgdb-4920638856fd2ee27d0f61330e75a05b8d719f02.zip
gdb-4920638856fd2ee27d0f61330e75a05b8d719f02.tar.gz
gdb-4920638856fd2ee27d0f61330e75a05b8d719f02.tar.bz2
bfd/elfnn-aarch64.c: Handle static links with ifunc correctly.
The code for handling GOT references to ifunc symbols in static links was missing. bfd/ChangeLog: 2013-11-26 Will Newton <will.newton@linaro.org> * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Handle STT_GNU_IFUNC symbols correctly in static links. ld/testsuite/ChangeLog: 2013-11-26 Will Newton <will.newton@linaro.org> * ld-aarch64/aarch64-elf.exp: Add ifunc-22. * ld-aarch64/ifunc-22.d: New file. * ld-aarch64/ifunc-22.s: Likewise.
Diffstat (limited to 'bfd/elfnn-aarch64.c')
-rw-r--r--bfd/elfnn-aarch64.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 7cce6f4..6a42bc5 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -6824,7 +6824,34 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
+ htab->root.sgot->output_offset
+ (h->got.offset & ~(bfd_vma) 1));
- if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
+ if (h->def_regular
+ && h->type == STT_GNU_IFUNC)
+ {
+ if (info->shared)
+ {
+ /* Generate R_AARCH64_GLOB_DAT. */
+ goto do_glob_dat;
+ }
+ else
+ {
+ asection *plt;
+
+ if (!h->pointer_equality_needed)
+ abort ();
+
+ /* For non-shared object, we can't use .got.plt, which
+ contains the real function address if we need pointer
+ equality. We load the GOT entry with the PLT entry. */
+ plt = htab->root.splt ? htab->root.splt : htab->root.iplt;
+ bfd_put_NN (output_bfd, (plt->output_section->vma
+ + plt->output_offset
+ + h->plt.offset),
+ htab->root.sgot->contents
+ + (h->got.offset & ~(bfd_vma) 1));
+ return TRUE;
+ }
+ }
+ else if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
{
if (!h->def_regular)
return FALSE;
@@ -6837,6 +6864,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
}
else
{
+do_glob_dat:
BFD_ASSERT ((h->got.offset & 1) == 0);
bfd_put_NN (output_bfd, (bfd_vma) 0,
htab->root.sgot->contents + h->got.offset);