aarch64: Add support for GNU indirect functions.
authorWill Newton <willnewton@sourceware.org>
Thu, 3 Oct 2013 14:46:09 +0000 (14:46 +0000)
committerWill Newton <willnewton@sourceware.org>
Thu, 3 Oct 2013 14:46:09 +0000 (14:46 +0000)
commit1419bbe5712af8a43f1d63feb32687649563426d
treefe399164ce85dcdd317dc7b53c678074932a1fa9
parent06ab7b19e0f364881cd4b0ef67b2064dd83ee1c6
aarch64: Add support for GNU indirect functions.

Add support for STT_GNU_IFUNC symbols to the AArch64 bfd backend. The tests
are ported from the ld-ifunc tests but are enabled for cross builds so can
be run easily without hardware or a simulator.

bfd/ChangeLog:

2013-10-03  Will Newton  <will.newton@linaro.org>

* configure: Regenerate.
* configure.in: Build elf-ifunc.o for AArch64.
* elfnn-aarch64.c: Include objalloc.h.
(elfNN_aarch64_local_htab_hash): New function.
(elfNN_aarch64_local_htab_eq): New function.
(elfNN_aarch64_get_local_sym_hash): New function.
(elfNN_aarch64_link_hash_table_create): Initialize local STT_GNU_IFUNC
symbol hash.
(elfNN_aarch64_hash_table_free): Free local STT_GNU_IFUNC symbol hash.
(elfNN_aarch64_final_link_relocate): Add sym argument.  Add support
for handling STT_GNU_IFUNC symbols.
(elfNN_aarch64_gc_sweep_hook): Add support for garbage collecting
references to STT_GNU_IFUNC symbols.
(elfNN_aarch64_adjust_dynamic_symbol): Add support for handling
STT_GNU_IFUNC symbols.
(elfNN_aarch64_check_relocs): Add support for handling STT_GNU_IFUNC
symbols.  Ensure we don't increase plt.refcount from -1 to 0.
(elfNN_aarch64_post_process_headers): Call _bfd_elf_set_osabi.
(elfNN_aarch64_is_function_type): Remove function.
(elfNN_aarch64_allocate_dynrelocs): Handle STT_GNU_IFUNC symbols.
(elfNN_aarch64_allocate_ifunc_dynrelocs): New function.
(elfNN_aarch64_allocate_local_dynrelocs): New function.
(elfNN_aarch64_allocate_local_ifunc_dynrelocs): New function.
(elfNN_aarch64_size_dynamic_sections): Call
elfNN_aarch64_allocate_local_dynrelocs.
(elfNN_aarch64_create_small_pltn_entry): Add info argument.
Add support for creating .iplt entries for STT_GNU_IFUNC symbols.
(elfNN_aarch64_finish_dynamic_symbol): Add support for handling
STT_GNU_IFUNC symbols and .iplt.
(elfNN_aarch64_finish_local_dynamic_symbol): New function.
(elfNN_aarch64_finish_dynamic_sections): Call
elfNN_aarch64_finish_local_dynamic_symbol.

ld/ChangeLog:

2013-10-03  Will Newton  <will.newton@linaro.org>

* emulparams/aarch64elf.sh: Add IREL_IN_PLT.
* emulparams/aarch64elf32.sh: Likewise.

ld/testsuite/ChangeLog:

2013-10-03  Will Newton  <will.newton@linaro.org>

* ld-ifunc/ifunc.exp: Enable ifunc tests for AArch64.
* ld-aarch64/aarch64-elf.exp: Run ifunc tests.
* ld-aarch64/ifunc-1-local.d: New file.
* ld-aarch64/ifunc-1-local.s: Likewise.
* ld-aarch64/ifunc-1.d: Likewise.
* ld-aarch64/ifunc-1.s: Likewise.
* ld-aarch64/ifunc-10.d: Likewise.
* ld-aarch64/ifunc-10.s: Likewise.
* ld-aarch64/ifunc-11.d: Likewise.
* ld-aarch64/ifunc-11.s: Likewise.
* ld-aarch64/ifunc-12.d: Likewise.
* ld-aarch64/ifunc-12.s: Likewise.
* ld-aarch64/ifunc-13.d: Likewise.
* ld-aarch64/ifunc-13a.s: Likewise.
* ld-aarch64/ifunc-13b.s: Likewise.
* ld-aarch64/ifunc-14a.d: Likewise.
* ld-aarch64/ifunc-14a.s: Likewise.
* ld-aarch64/ifunc-14b.d: Likewise.
* ld-aarch64/ifunc-14b.s: Likewise.
* ld-aarch64/ifunc-14c.d: Likewise.
* ld-aarch64/ifunc-14c.s: Likewise.
* ld-aarch64/ifunc-14d.d: Likewise.
* ld-aarch64/ifunc-14e.d: Likewise.
* ld-aarch64/ifunc-14f.d: Likewise.
* ld-aarch64/ifunc-15.d: Likewise.
* ld-aarch64/ifunc-15.s: Likewise.
* ld-aarch64/ifunc-16.d: Likewise.
* ld-aarch64/ifunc-16.s: Likewise.
* ld-aarch64/ifunc-17a.d: Likewise.
* ld-aarch64/ifunc-17a.s: Likewise.
* ld-aarch64/ifunc-17b.d: Likewise.
* ld-aarch64/ifunc-17b.s: Likewise.
* ld-aarch64/ifunc-18a.d: Likewise.
* ld-aarch64/ifunc-18a.s: Likewise.
* ld-aarch64/ifunc-18b.d: Likewise.
* ld-aarch64/ifunc-18b.s: Likewise.
* ld-aarch64/ifunc-19a.d: Likewise.
* ld-aarch64/ifunc-19a.s: Likewise.
* ld-aarch64/ifunc-19b.d: Likewise.
* ld-aarch64/ifunc-19b.s: Likewise.
* ld-aarch64/ifunc-2-local.d: Likewise.
* ld-aarch64/ifunc-2-local.s: Likewise.
* ld-aarch64/ifunc-2.d: Likewise.
* ld-aarch64/ifunc-2.s: Likewise.
* ld-aarch64/ifunc-20.d: Likewise.
* ld-aarch64/ifunc-20.s: Likewise.
* ld-aarch64/ifunc-3.s: Likewise.
* ld-aarch64/ifunc-3a.d: Likewise.
* ld-aarch64/ifunc-3b.d: Likewise.
* ld-aarch64/ifunc-4.d: Likewise.
* ld-aarch64/ifunc-4.s: Likewise.
* ld-aarch64/ifunc-4a.d: Likewise.
* ld-aarch64/ifunc-5-local.s: Likewise.
* ld-aarch64/ifunc-5.s: Likewise.
* ld-aarch64/ifunc-5a-local.d: Likewise.
* ld-aarch64/ifunc-5a.d: Likewise.
* ld-aarch64/ifunc-5b-local.d: Likewise.
* ld-aarch64/ifunc-5b.d: Likewise.
* ld-aarch64/ifunc-5r-local.d: Likewise.
* ld-aarch64/ifunc-6.s: Likewise.
* ld-aarch64/ifunc-6a.d: Likewise.
* ld-aarch64/ifunc-6b.d: Likewise.
* ld-aarch64/ifunc-7.s: Likewise.
* ld-aarch64/ifunc-7a.d: Likewise.
* ld-aarch64/ifunc-7b.d: Likewise.
* ld-aarch64/ifunc-7c.d: Likewise.
* ld-aarch64/ifunc-8.d: Likewise.
* ld-aarch64/ifunc-8a.s: Likewise.
* ld-aarch64/ifunc-8b.s: Likewise.
* ld-aarch64/ifunc-9.d: Likewise.
* ld-aarch64/ifunc-9.s: Likewise.
78 files changed:
bfd/ChangeLog
bfd/configure.in
bfd/elfnn-aarch64.c
ld/ChangeLog
ld/emulparams/aarch64elf.sh
ld/emulparams/aarch64elf32.sh
ld/testsuite/ChangeLog
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/ifunc-1-local.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-1-local.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-1.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-1.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-10.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-10.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-11.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-11.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-12.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-12.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-13.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-13a.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-13b.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14a.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14b.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14c.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14c.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14d.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14e.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-14f.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-15.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-15.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-16.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-16.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-17a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-17a.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-17b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-17b.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-18a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-18a.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-18b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-18b.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-19a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-19a.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-19b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-19b.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-2-local.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-2-local.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-2.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-2.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-20.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-20.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-3.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-3a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-3b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-4.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-4.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-4a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-5-local.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-5.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-5a-local.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-5a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-5b-local.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-5b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-5r-local.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-6.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-6a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-6b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-7.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-7a.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-7b.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-7c.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-8.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-8a.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-8b.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-9.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/ifunc-9.s [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc.exp