From 389b8029b69e2a4cdbc3a23d0ee9d5b3c974bd34 Mon Sep 17 00:00:00 2001 From: Marcus Shawcroft Date: Wed, 18 Feb 2015 15:36:40 +0000 Subject: [PATCH] [AArch64] Add support for :tlsdesc: and TLSDESC_ADR_PREL21 --- bfd/ChangeLog | 12 ++++++++++++ bfd/elfnn-aarch64.c | 17 ++++++++++++++++- bfd/elfxx-aarch64.c | 2 ++ gas/ChangeLog | 7 +++++++ gas/config/tc-aarch64.c | 4 +++- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3132320f08e..0103df24148 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2015-02-26 Marcus Shawcroft + + * elfnn-aarch64.c (IS_AARCH64_TLSDESC_RELOC) BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 move. + (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_TLSDESC_ADR_PREL21. + * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend) + (_bfd_aarch64_elf_resolve_relocation): Likewise. + * reloc.c (BFD_RELOC_AARCH64_TLSGD_ADR_PREL21): Define. + 2015-02-26 Marcus Shawcroft * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC) diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 1ff18651a42..ee88b5dc28c 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -189,8 +189,8 @@ #define IS_AARCH64_TLSDESC_RELOC(R_TYPE) \ ((R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 \ - || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 \ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 \ + || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 \ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC \ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC \ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC \ @@ -3750,6 +3750,11 @@ aarch64_tls_transition_without_check (bfd_reloc_code_real_type r_type, ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1 : BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21); + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: + return (is_local + ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC + : r_type); + case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC: return (is_local @@ -3800,6 +3805,7 @@ aarch64_reloc_got_type (bfd_reloc_code_real_type r_type) case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSDESC_CALL: case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC: @@ -4545,6 +4551,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, case BFD_RELOC_AARCH64_TLSDESC_ADD: case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LDR: @@ -4618,6 +4625,11 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals, return bfd_reloc_continue; } + + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: + BFD_ASSERT (0); + break; + case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21: if (is_local) { @@ -5092,6 +5104,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC: if (! symbol_tlsdesc_got_offset_mark_p (input_bfd, h, r_symndx)) { @@ -5460,6 +5473,7 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd, case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC: case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC: @@ -5930,6 +5944,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC: case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC: diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index b5a93341600..929eb648199 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -252,6 +252,7 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, case BFD_RELOC_AARCH64_TLSDESC_CALL: break; + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21: case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21: case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: @@ -378,6 +379,7 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type, case BFD_RELOC_AARCH64_NONE: break; + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21: case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19: case BFD_RELOC_AARCH64_ADR_LO21_PCREL: diff --git a/gas/ChangeLog b/gas/ChangeLog index b4eadfb0cee..a769877edab 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_TLSDESC_ADR_PREL21. + (md_apply_fix, aarch64_force_relocation): Handle + BFD_RELOC_AARCH64_TLSGD_ADR_PREL21. + 2015-02-19 Marcus Shawcroft * config/tc-aarch64.c (reloc_table_entry): Generate diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index bcd6f4fb270..ce56dc3b571 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -2474,7 +2474,7 @@ static struct reloc_table_entry reloc_table[] = { /* Get to the page containing GOT TLS entry for a symbol */ {"tlsdesc", 0, - 0, /* adr_type */ + BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21, /* adr_type */ BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21, 0, 0, @@ -6708,6 +6708,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg) case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC: case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC: @@ -6909,6 +6910,7 @@ aarch64_force_relocation (struct fix *fixp) case BFD_RELOC_AARCH64_LDST8_LO12: case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21: + case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21: case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC: case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC: case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC: -- 2.30.2