From 7018c0308ac5d936b68c280bfcdc80bef77225e1 Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Mon, 1 Jun 2015 15:45:25 +0100 Subject: [AArch64] BFD support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 This patch add BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 relocation supoprt in bfd linker. 2015-06-01 Jiong Wang bfd/ * elfnn-aarch64.c (aarch64_reloc_got_type): Support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14. (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-28.s: New test file. * ld-aarch64/emit-relocs-28.d: Ditto. * ld-aarch64/aarch64-elf.exp: Run new test. --- bfd/elfnn-aarch64.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'bfd/elfnn-aarch64.c') diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 3104de7..4065dfc 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4067,6 +4067,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_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -4621,6 +4622,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, howto, value); case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -4682,7 +4684,8 @@ 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) + if (bfd_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 + || bfd_r_type == BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14) addend = (globals->root.sgot->output_section->vma + globals->root.sgot->output_offset); value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, @@ -4890,6 +4893,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_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -4902,7 +4906,8 @@ 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) + if (bfd_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 + || bfd_r_type == BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14) addend = (globals->root.sgot->output_section->vma + globals->root.sgot->output_offset); value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, @@ -4960,7 +4965,8 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, the direct data access into indirect data access through GOT. */ value = got_entry_addr; - if (bfd_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15) + if (bfd_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 + || bfd_r_type == BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14) addend = base_got->output_section->vma + base_got->output_offset; value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, @@ -5959,6 +5965,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_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -6317,6 +6324,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, case BFD_RELOC_AARCH64_CALL26: case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_JUMP26: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -6429,6 +6437,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, there are no dangling GOT_PAGE relocs. */ case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: -- cgit v1.1