From 043bf05a3d8e4bf7706f7c038540b893ec075051 Mon Sep 17 00:00:00 2001 From: Marcus Shawcroft Date: Fri, 13 Feb 2015 09:57:11 +0000 Subject: [PATCH] Adding support for TLSIE_LD_GOTTREL_PREL19. --- bfd/ChangeLog | 12 ++++++++++++ bfd/elfnn-aarch64.c | 13 ++++++++++++- bfd/elfxx-aarch64.c | 2 ++ gas/ChangeLog | 7 +++++++ gas/config/tc-aarch64.c | 4 +++- 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3b7aff8715..4d347f4385 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2015-02-26 Marcus Shawcroft + + * elfnn-aarch64.c: (TLSIE_LD_GOTTREL_PREL19): Fix HOWTO bit field width. + (aarch64_tls_transition_without_check, aarch64_reloc_got_type) + (elfNN_aarch64_final_link_relocate, elfNN_aarch64_tls_relax) + (elfNN_aarch64_relocate_section, elfNN_aarch64_gc_sweep_hook) + (elfNN_aarch64_check_relocs): Handle + BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19. + + * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend) + (_bfd_aarch64_elf_resolve_relocation): Likewise. + 2015-02-26 Marcus Shawcroft * elfnn-aarch64.c: (TLSDESC_CALL): Fix HOWTO bit field width. diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index b863244763..3d9c383f10 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -951,7 +951,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] = HOWTO (AARCH64_R (TLSIE_LD_GOTTPREL_PREL19), /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ - 21, /* bitsize */ + 19, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ @@ -3747,6 +3747,9 @@ aarch64_tls_transition_without_check (bfd_reloc_code_real_type r_type, case BFD_RELOC_AARCH64_TLSIE_LDNN_GOTTPREL_LO12_NC: return is_local ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC : r_type; + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: + return r_type; + case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_CALL: /* Instructions with these relocations will become NOPs. */ @@ -3784,6 +3787,7 @@ aarch64_reloc_got_type (bfd_reloc_code_real_type r_type) case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: return GOT_TLS_IE; case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12: @@ -4489,6 +4493,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: if (globals->root.sgot == NULL) return bfd_reloc_notsupported; @@ -4591,6 +4596,9 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals, return bfd_reloc_continue; } + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: + return bfd_reloc_continue; + case BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC: if (is_local) { @@ -4954,6 +4962,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: case BFD_RELOC_AARCH64_TLSIE_LDNN_GOTTPREL_LO12_NC: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: if (! symbol_got_offset_mark_p (input_bfd, h, r_symndx)) { bfd_boolean need_relocs = FALSE; @@ -5390,6 +5399,7 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd, case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC: case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC: @@ -5858,6 +5868,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC: case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC: diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index 66c03e3eee..328743d8b1 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -243,6 +243,7 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, case BFD_RELOC_AARCH64_LD_LO19_PCREL: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: if (old_addend & ((1 << howto->rightshift) - 1)) return bfd_reloc_overflow; contents = reencode_ld_lit_ofs_19 (contents, addend); @@ -376,6 +377,7 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type, case BFD_RELOC_AARCH64_NONE: break; + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: case BFD_RELOC_AARCH64_ADR_LO21_PCREL: case BFD_RELOC_AARCH64_BRANCH19: case BFD_RELOC_AARCH64_LD_LO19_PCREL: diff --git a/gas/ChangeLog b/gas/ChangeLog index 59d1c3dbf6..ba92ff9b31 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2015-02-19 Marcus Shawcroft + + * config/tc-aarch64.c (reloc_table_entry): Generate + BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19. + (md_apply_fix, aarch64_force_relocation): Handle + BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19. + 2015-02-26 Marcus Shawcroft * config/tc-aarch64.c (reloc_table_entry): Add ld_literal_type. diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 6795c06a18..02122efacc 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -2497,7 +2497,7 @@ static struct reloc_table_entry reloc_table[] = { 0, 0, 0, - 0}, + BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19}, /* 12 bit offset into the page containing GOT TLS entry for a symbol */ {"gottprel_lo12", 0, @@ -6715,6 +6715,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg) case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC: case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC: @@ -6914,6 +6915,7 @@ aarch64_force_relocation (struct fix *fixp) case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC: case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: + case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12: case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC: -- 2.34.1