[AArch64] Drop unused argument to elf_aarch64_create_or_find_stub_sec
[deliverable/binutils-gdb.git] / bfd / elfnn-aarch64.c
index d218c88506381f875ec4534683e9d1b95ab87ef3..acef708fc6d7c02d8cc12aa8197f81e4315a5f36 100644 (file)
 
 #define IS_AARCH64_TLS_RELOC(R_TYPE)                           \
   ((R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21              \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PREL21           \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC          \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1     \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC  \
 
 #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       \
@@ -863,6 +864,20 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
         0x1fffff,              /* dst_mask */
         TRUE),                 /* pcrel_offset */
 
+  HOWTO (AARCH64_R (TLSGD_ADR_PREL21), /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        21,                    /* bitsize */
+        TRUE,                  /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont,        /* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        AARCH64_R_STR (TLSGD_ADR_PREL21),      /* name */
+        FALSE,                 /* partial_inplace */
+        0x1fffff,              /* src_mask */
+        0x1fffff,              /* dst_mask */
+        TRUE),                 /* pcrel_offset */
+
   /* ADD: GOT offset G(S) & 0xff8 [no overflow check] */
   HOWTO (AARCH64_R (TLSGD_ADD_LO12_NC),        /* type */
         0,                     /* rightshift */
@@ -951,7 +966,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 */
@@ -1077,15 +1092,15 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
   HOWTO (AARCH64_R (TLSDESC_LD_PREL19),        /* type */
         2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-        21,                    /* bitsize */
+        19,                    /* bitsize */
         TRUE,                  /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont,        /* complain_on_overflow */
         bfd_elf_generic_reloc, /* special_function */
         AARCH64_R_STR (TLSDESC_LD_PREL19),     /* name */
         FALSE,                 /* partial_inplace */
-        0x1ffffc,              /* src_mask */
-        0x1ffffc,              /* dst_mask */
+        0x0ffffe0,             /* src_mask */
+        0x0ffffe0,             /* dst_mask */
         TRUE),                 /* pcrel_offset */
 
   HOWTO (AARCH64_R (TLSDESC_ADR_PREL21),       /* type */
@@ -1222,7 +1237,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
   HOWTO (AARCH64_R (TLSDESC_CALL),     /* type */
         0,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
-        12,                    /* bitsize */
+        0,                     /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont,        /* complain_on_overflow */
@@ -1832,12 +1847,6 @@ struct elf_aarch64_link_hash_table
   /* Fix erratum 835769.  */
   int fix_erratum_835769;
 
-  /* A table of fix locations for erratum 835769.  This holds erratum
-     fix locations between elfNN_aarch64_size_stubs() and
-     elfNN_aarch64_write_section().  */
-  struct aarch64_erratum_835769_fix *aarch64_erratum_835769_fixes;
-  unsigned int num_aarch64_erratum_835769_fixes;
-
   /* The number of bytes in the initial entry in the PLT.  */
   bfd_size_type plt_header_size;
 
@@ -2430,8 +2439,7 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
       template_size = sizeof (aarch64_erratum_835769_stub);
       break;
     default:
-      BFD_FAIL ();
-      return FALSE;
+      abort ();
     }
 
   for (i = 0; i < (template_size / sizeof template[0]); i++)
@@ -2489,7 +2497,7 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
       break;
 
     default:
-      break;
+      abort ();
     }
 
   return TRUE;
@@ -2520,9 +2528,7 @@ aarch64_size_one_stub (struct bfd_hash_entry *gen_entry,
       size = sizeof (aarch64_erratum_835769_stub);
       break;
     default:
-      BFD_FAIL ();
-      return FALSE;
-      break;
+      abort ();
     }
 
   size = (size + 7) & ~7;
@@ -2743,12 +2749,19 @@ group_sections (struct elf_aarch64_link_hash_table *htab,
 #define AARCH64_LDST_SIMD_S(insn) (((insn) & 0xbf9f0000) == 0x0d000000)
 #define AARCH64_LDST_SIMD_S_PI(insn) (((insn) & 0xbf800000) == 0x0d800000)
 
-/* Classify an INSN if it is indeed a load/store.  Return TRUE if INSN
-   is a load/store along with the Rt and Rtn.  Return FALSE if not a
-   load/store.  */
+/* Classify an INSN if it is indeed a load/store.
+
+   Return TRUE if INSN is a LD/ST instruction otherwise return FALSE.
+
+   For scalar LD/ST instructions PAIR is FALSE, RT is returned and RT2
+   is set equal to RT.
+
+   For LD/ST pair instructions PAIR is TRUE, RT and RT2 are returned.
+
+ */
 
 static bfd_boolean
-aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rtn,
+aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rt2,
                  bfd_boolean *pair, bfd_boolean *load)
 {
   uint32_t opcode;
@@ -2767,11 +2780,11 @@ aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rtn,
   if (AARCH64_LDST_EX (insn))
     {
       *rt = AARCH64_RT (insn);
-      *rtn = *rt;
+      *rt2 = *rt;
       if (AARCH64_BIT (insn, 21) == 1)
         {
          *pair = TRUE;
-         *rtn = AARCH64_RT2 (insn);
+         *rt2 = AARCH64_RT2 (insn);
        }
       *load = AARCH64_LD (insn);
       return TRUE;
@@ -2783,7 +2796,7 @@ aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rtn,
     {
       *pair = TRUE;
       *rt = AARCH64_RT (insn);
-      *rtn = AARCH64_RT2 (insn);
+      *rt2 = AARCH64_RT2 (insn);
       *load = AARCH64_LD (insn);
       return TRUE;
     }
@@ -2796,7 +2809,7 @@ aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rtn,
           || AARCH64_LDST_UIMM (insn))
    {
       *rt = AARCH64_RT (insn);
-      *rtn = *rt;
+      *rt2 = *rt;
       if (AARCH64_LDST_PCREL (insn))
        *load = TRUE;
       opc = AARCH64_BITS (insn, 22, 2);
@@ -2816,21 +2829,21 @@ aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rtn,
        {
        case 0:
        case 2:
-         *rtn = *rt + 3;
+         *rt2 = *rt + 3;
          break;
 
        case 4:
        case 6:
-         *rtn = *rt + 2;
+         *rt2 = *rt + 2;
          break;
 
        case 7:
-         *rtn = *rt;
+         *rt2 = *rt;
          break;
 
        case 8:
        case 10:
-         *rtn = *rt + 1;
+         *rt2 = *rt + 1;
          break;
 
        default:
@@ -2850,21 +2863,21 @@ aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rtn,
        case 0:
        case 2:
        case 4:
-         *rtn = *rt + r;
+         *rt2 = *rt + r;
          break;
 
        case 1:
        case 3:
        case 5:
-         *rtn = *rt + (r == 0 ? 2 : 3);
+         *rt2 = *rt + (r == 0 ? 2 : 3);
          break;
 
        case 6:
-         *rtn = *rt + r;
+         *rt2 = *rt + r;
          break;
 
        case 7:
-         *rtn = *rt + (r == 0 ? 2 : 3);
+         *rt2 = *rt + (r == 0 ? 2 : 3);
          break;
 
        default:
@@ -2910,7 +2923,7 @@ static bfd_boolean
 aarch64_erratum_sequence (uint32_t insn_1, uint32_t insn_2)
 {
   uint32_t rt;
-  uint32_t rtn;
+  uint32_t rt2;
   uint32_t rn;
   uint32_t rm;
   uint32_t ra;
@@ -2918,7 +2931,7 @@ aarch64_erratum_sequence (uint32_t insn_1, uint32_t insn_2)
   bfd_boolean load;
 
   if (aarch64_mlxl_p (insn_2)
-      && aarch64_mem_op_p (insn_1, &rt, &rtn, &pair, &load))
+      && aarch64_mem_op_p (insn_1, &rt, &rt2, &pair, &load))
     {
       /* Any SIMD memory op is independent of the subsequent MLA
         by definition of the erratum.  */
@@ -2934,7 +2947,7 @@ aarch64_erratum_sequence (uint32_t insn_1, uint32_t insn_2)
         and this is not an erratum sequence.  */
       if (load &&
          (rt == rn || rt == rm || rt == ra
-          || (pair && (rtn == rn || rtn == rm || rtn == ra))))
+          || (pair && (rt2 == rn || rt2 == rm || rt2 == ra))))
        return FALSE;
 
       /* We conservatively put out stubs for all other cases (including
@@ -3069,13 +3082,11 @@ erratum_835769_scan (bfd *input_bfd,
   return FALSE;
 }
 
-/* Find or create a stub section.  Returns a pointer to the stub section, and
-   the section to which the stub section will be attached (in *LINK_SEC_P).
-   LINK_SEC_P may be NULL.  */
+/* Find or create a stub section.  */
 
 static asection *
-elf_aarch64_create_or_find_stub_sec (asection **link_sec_p, asection *section,
-                                  struct elf_aarch64_link_hash_table *htab)
+elf_aarch64_create_or_find_stub_sec (asection *section,
+                                    struct elf_aarch64_link_hash_table *htab)
 {
   asection *link_sec;
   asection *stub_sec;
@@ -3110,9 +3121,6 @@ elf_aarch64_create_or_find_stub_sec (asection **link_sec_p, asection *section,
       htab->stub_group[section->id].stub_sec = stub_sec;
     }
 
-  if (link_sec_p)
-    *link_sec_p = link_sec;
-
   return stub_sec;
 }
 
@@ -3178,13 +3186,12 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
   while (1)
     {
       bfd *input_bfd;
-      unsigned int bfd_indx;
       asection *stub_sec;
       unsigned prev_num_erratum_835769_fixes = num_erratum_835769_fixes;
 
       num_erratum_835769_fixes = 0;
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
-          input_bfd != NULL; input_bfd = input_bfd->link.next, bfd_indx++)
+      for (input_bfd = info->input_bfds;
+          input_bfd != NULL; input_bfd = input_bfd->link.next)
        {
          Elf_Internal_Shdr *symtab_hdr;
          asection *section;
@@ -3469,8 +3476,8 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
       if (htab->fix_erratum_835769)
        for (i = 0; i < num_erratum_835769_fixes; i++)
          {
-           stub_sec = elf_aarch64_create_or_find_stub_sec (NULL,
-                        erratum_835769_fixes[i].section, htab);
+           stub_sec = elf_aarch64_create_or_find_stub_sec
+             (erratum_835769_fixes[i].section, htab);
 
            if (stub_sec == NULL)
              goto error_ret_free_local;
@@ -3514,16 +3521,6 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
          stub_entry->veneered_insn = erratum_835769_fixes[i].veneered_insn;
          stub_entry->output_name = erratum_835769_fixes[i].stub_name;
        }
-
-      /* Stash the erratum 835769 fix array for use later in
-        elfNN_aarch64_write_section().  */
-      htab->aarch64_erratum_835769_fixes = erratum_835769_fixes;
-      htab->num_aarch64_erratum_835769_fixes = num_erratum_835769_fixes;
-    }
-  else
-    {
-      htab->aarch64_erratum_835769_fixes = NULL;
-      htab->num_aarch64_erratum_835769_fixes = 0;
     }
 
   return TRUE;
@@ -3735,6 +3732,16 @@ 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_TLSDESC_LD_PREL19:
+      return (is_local
+             ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1
+             : BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19);
+
     case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC:
       return (is_local
@@ -3747,6 +3754,14 @@ 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_TLSGD_ADR_PREL21:
+      return (is_local
+             ? BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12
+             : BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19);
+
     case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSDESC_CALL:
       /* Instructions with these relocations will become NOPs.  */
@@ -3771,19 +3786,23 @@ aarch64_reloc_got_type (bfd_reloc_code_real_type r_type)
       return GOT_NORMAL;
 
     case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+    case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
     case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
       return GOT_TLS_GD;
 
     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:
+    case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
       return GOT_TLSDESC_GD;
 
     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:
@@ -4037,7 +4056,7 @@ elfNN_aarch64_write_section (bfd *output_bfd  ATTRIBUTE_UNUSED,
 
 {
   struct elf_aarch64_link_hash_table *globals =
-                                       elf_aarch64_hash_table (link_info);
+    elf_aarch64_hash_table (link_info);
 
   if (globals == NULL)
     return FALSE;
@@ -4485,10 +4504,12 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
       break;
 
     case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+    case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
     case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
     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;
 
@@ -4518,9 +4539,11 @@ 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:
+    case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
       if (globals->root.sgot == NULL)
        return bfd_reloc_notsupported;
       value = (symbol_tlsdesc_got_offset (input_bfd, h, r_symndx)
@@ -4591,6 +4614,99 @@ 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_TLSDESC_LD_PREL19:
+      if (is_local)
+       {
+         /* Tiny TLSDESC->LE relaxation:
+            ldr   x1, :tlsdesc:var      =>  movz  x0, #:tprel_g1:var
+            adr   x0, :tlsdesc:var      =>  movk  x0, #:tprel_g0_nc:var
+            .tlsdesccall var
+            blr   x1                    =>  nop
+          */
+         BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (TLSDESC_ADR_PREL21));
+         BFD_ASSERT (ELFNN_R_TYPE (rel[2].r_info) == AARCH64_R (TLSDESC_CALL));
+
+         rel[1].r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel->r_info),
+                                       AARCH64_R (TLSLE_MOVW_TPREL_G0_NC));
+         rel[2].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+         bfd_putl32 (0xd2a00000, contents + rel->r_offset);
+         bfd_putl32 (0xf2800000, contents + rel->r_offset + 4);
+         bfd_putl32 (INSN_NOP, contents + rel->r_offset + 8);
+         return bfd_reloc_continue;
+       }
+      else
+       {
+         /* Tiny TLSDESC->IE relaxation:
+            ldr   x1, :tlsdesc:var      =>  ldr   x0, :gottprel:var
+            adr   x0, :tlsdesc:var      =>  nop
+            .tlsdesccall var
+            blr   x1                    =>  nop
+          */
+         BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (TLSDESC_ADR_PREL21));
+         BFD_ASSERT (ELFNN_R_TYPE (rel[2].r_info) == AARCH64_R (TLSDESC_CALL));
+
+         rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+         rel[2].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+         bfd_putl32 (0x58000000, contents + rel->r_offset);
+         bfd_putl32 (INSN_NOP, contents + rel->r_offset + 4);
+         bfd_putl32 (INSN_NOP, contents + rel->r_offset + 8);
+         return bfd_reloc_continue;
+       }
+
+    case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+      if (is_local)
+       {
+         /* Tiny GD->LE relaxation:
+            adr x0, :tlsgd:var      =>   mrs  x1, tpidr_el0
+             bl   __tls_get_addr     =>   add  x0, x1, #:tprel_hi12:x, lsl #12
+             nop                     =>   add  x0, x0, #:tprel_lo12_nc:x
+          */
+
+         /* First kill the tls_get_addr reloc on the bl instruction.  */
+         BFD_ASSERT (rel->r_offset + 4 == rel[1].r_offset);
+
+         bfd_putl32 (0xd53bd041, contents + rel->r_offset + 0);
+         bfd_putl32 (0x91400020, contents + rel->r_offset + 4);
+         bfd_putl32 (0x91000000, contents + rel->r_offset + 8);
+
+         rel[1].r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel->r_info),
+                                       AARCH64_R (TLSLE_ADD_TPREL_LO12_NC));
+         rel[1].r_offset = rel->r_offset + 8;
+
+         /* Move the current relocation to the second instruction in
+            the sequence.  */
+         rel->r_offset += 4;
+         rel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel->r_info),
+                                     AARCH64_R (TLSLE_ADD_TPREL_HI12));
+         return bfd_reloc_continue;
+       }
+      else
+       {
+         /* Tiny GD->IE relaxation:
+            adr x0, :tlsgd:var      =>   ldr  x0, :gottprel:var
+            bl   __tls_get_addr     =>   mrs  x1, tpidr_el0
+            nop                     =>   add  x0, x0, x1
+          */
+
+         /* First kill the tls_get_addr reloc on the bl instruction.  */
+         BFD_ASSERT (rel->r_offset + 4 == rel[1].r_offset);
+         rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+         bfd_putl32 (0x58000000, contents + rel->r_offset);
+         bfd_putl32 (0xd53bd041, contents + rel->r_offset + 4);
+         bfd_putl32 (0x8b000020, contents + rel->r_offset + 8);
+         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)
        {
@@ -4876,6 +4992,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
       switch (elfNN_aarch64_bfd_reloc_from_type (r_type))
        {
        case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+       case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
        case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
          if (! symbol_got_offset_mark_p (input_bfd, h, r_symndx))
            {
@@ -4954,6 +5071,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;
@@ -5015,7 +5133,9 @@ 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:
+       case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
          if (! symbol_tlsdesc_got_offset_mark_p (input_bfd, h, r_symndx))
            {
              bfd_boolean need_relocs = FALSE;
@@ -5383,13 +5503,17 @@ 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_TLSDESC_LD_PREL19:
        case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
        case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+       case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
        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:
@@ -5851,13 +5975,17 @@ 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_TLSDESC_LD_PREL19:
        case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
        case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+       case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
        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:
@@ -6406,7 +6534,7 @@ aarch64_map_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
        return FALSE;
       break;
     default:
-      BFD_FAIL ();
+      abort ();
     }
 
   return TRUE;
This page took 0.030896 seconds and 4 git commands to generate.