diff options
author | Jiong Wang <jiong.wang@arm.com> | 2015-06-01 10:26:00 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2015-06-01 10:26:00 +0100 |
commit | 99ad26cb0d4f9152dbe5ed03b74020cc52d84d94 (patch) | |
tree | 502f8f3dae34bf81874a5c32c0a4043cc0d5d397 /bfd | |
parent | a921b5bd708cc6e8afa3cf33443cda54b4e8cae6 (diff) | |
download | fsf-binutils-gdb-99ad26cb0d4f9152dbe5ed03b74020cc52d84d94.zip fsf-binutils-gdb-99ad26cb0d4f9152dbe5ed03b74020cc52d84d94.tar.gz fsf-binutils-gdb-99ad26cb0d4f9152dbe5ed03b74020cc52d84d94.tar.bz2 |
[AArch64] BFD Support BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15
2015-06-01 Jiong Wang <jiong.wang@arm.com>
bfd/
* elfnn-aarch64.c (aarch64_reloc_got_type): Support
BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15.
(elfNN_aarch64_final_link_relocate): Ditto.
(elfNN_aarch64_gc_swap_hook): Ditto.
(elfNN_aarch64_check_relocs): Ditto.
* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
ld/testsuite/
* ld-aarch64/emit-relocs-313.s: New test file.
* ld-aarch64/emit-relocs-313.d: Ditto.
* ld-aarch64/aarch64-elf.exp: Run new test.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 25 | ||||
-rw-r--r-- | bfd/elfxx-aarch64.c | 6 |
3 files changed, 38 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ccb2928..5ae71b2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,14 @@ 2015-06-01 Jiong Wang <jiong.wang@arm.com> + * elfnn-aarch64.c (aarch64_reloc_got_type): Support + BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15. + (elfNN_aarch64_final_link_relocate): Ditto. + (elfNN_aarch64_gc_swap_hook): Ditto. + (elfNN_aarch64_check_relocs): Ditto. + * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto. + +2015-06-01 Jiong Wang <jiong.wang@arm.com> + * reloc.c (BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15): New entry. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 2615f248..bcb25fd 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4052,6 +4052,7 @@ aarch64_reloc_got_type (bfd_reloc_code_real_type r_type) case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: return GOT_NORMAL; @@ -4507,6 +4508,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, { asection *plt; const char *name; + bfd_vma addend = 0; if ((input_section->flags & SEC_ALLOC) == 0 || h->plt.offset == (bfd_vma) -1) @@ -4604,6 +4606,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: base_got = globals->root.sgot; off = h->got.offset; @@ -4663,8 +4666,11 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, value = aarch64_calculate_got_entry_vma (h, globals, info, value, output_bfd, unresolved_reloc_p); + if (bfd_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15) + addend = (globals->root.sgot->output_section->vma + + globals->root.sgot->output_offset); value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, - 0, weak_undef_p); + addend, weak_undef_p); return _bfd_aarch64_elf_put_addend (input_bfd, hit_data, bfd_r_type, howto, value); case BFD_RELOC_AARCH64_ADD_LO12: case BFD_RELOC_AARCH64_ADR_HI21_PCREL: @@ -4869,20 +4875,26 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: if (globals->root.sgot == NULL) BFD_ASSERT (h != NULL); if (h != NULL) { + bfd_vma addend = 0; value = aarch64_calculate_got_entry_vma (h, globals, info, value, output_bfd, unresolved_reloc_p); + if (bfd_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15) + addend = (globals->root.sgot->output_section->vma + + globals->root.sgot->output_offset); value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, - 0, weak_undef_p); + addend, weak_undef_p); } else { + bfd_vma addend = 0; struct elf_aarch64_local_symbol *locals = elf_aarch64_locals (input_bfd); @@ -4931,6 +4943,12 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, /* Update the relocation value to GOT entry addr as we have transformed the direct data access into indirect data access through GOT. */ value = got_entry_addr; + + if (bfd_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15) + addend = base_got->output_section->vma + base_got->output_offset; + + value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, + addend, weak_undef_p); } break; @@ -5926,6 +5944,7 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd, case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: @@ -6283,6 +6302,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_JUMP26: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: case BFD_RELOC_AARCH64_NN: if (htab->root.dynobj == NULL) @@ -6394,6 +6414,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index 576df78..889b0d0 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -258,6 +258,7 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, break; case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: case BFD_RELOC_AARCH64_LDST128_LO12: case BFD_RELOC_AARCH64_LDST16_LO12: @@ -413,6 +414,11 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type, value = PG (value + addend) - PG (place); break; + case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: + /* Caller must make sure addend is the base address of .got section. */ + value = value - PG (addend); + break; + case BFD_RELOC_AARCH64_ADD_LO12: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: |