rx-elf FAIL: SHF_GNU_RETAIN sections 27
[binutils-gdb.git] / bfd / elf32-tilepro.c
index 2d78f3c9c89c1ef0c0e372af28d40156f2608cab..351146673943f839f07b14a7e0ae488eb10446e2 100644 (file)
@@ -727,19 +727,11 @@ tilepro_elf_mkobject (bfd *abfd)
 #include "elf/common.h"
 #include "elf/internal.h"
 
-struct tilepro_elf_link_hash_table
-{
-  struct elf_link_hash_table elf;
-
-  /* Small local sym to section mapping cache.  */
-  struct sym_cache sym_cache;
-};
-
 /* Get the Tilepro ELF linker hash table from a link_info structure.  */
 #define tilepro_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == TILEPRO_ELF_DATA \
-  ? ((struct tilepro_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == TILEPRO_ELF_DATA)     \
+   ? (struct elf_link_hash_table *) (p)->hash : NULL)
 
 static reloc_howto_type *
 tilepro_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
@@ -1184,14 +1176,14 @@ link_hash_newfunc (struct bfd_hash_entry *entry,
 static struct bfd_link_hash_table *
 tilepro_elf_link_hash_table_create (bfd *abfd)
 {
-  struct tilepro_elf_link_hash_table *ret;
-  size_t amt = sizeof (struct tilepro_elf_link_hash_table);
+  struct elf_link_hash_table *ret;
+  size_t amt = sizeof (struct elf_link_hash_table);
 
-  ret = (struct tilepro_elf_link_hash_table *) bfd_zmalloc (amt);
+  ret = (struct elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
-  if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc,
+  if (!_bfd_elf_link_hash_table_init (ret, abfd, link_hash_newfunc,
                                      sizeof (struct tilepro_elf_link_hash_entry),
                                      TILEPRO_ELF_DATA))
     {
@@ -1199,7 +1191,7 @@ tilepro_elf_link_hash_table_create (bfd *abfd)
       return NULL;
     }
 
-  return &ret->elf.root;
+  return &ret->root;
 }
 
 /* Create the .got section.  */
@@ -1402,7 +1394,7 @@ static bfd_boolean
 tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
                          asection *sec, const Elf_Internal_Rela *relocs)
 {
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
   const Elf_Internal_Rela *rel;
@@ -1423,8 +1415,8 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
 
   BFD_ASSERT (is_tilepro_elf (abfd) || num_relocs == 0);
 
-  if (htab->elf.dynobj == NULL)
-    htab->elf.dynobj = abfd;
+  if (htab->dynobj == NULL)
+    htab->dynobj = abfd;
 
   rel_end = relocs + num_relocs;
   for (rel = relocs; rel < rel_end; rel++)
@@ -1569,9 +1561,9 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
              }
          }
 
-         if (htab->elf.sgot == NULL)
+         if (htab->sgot == NULL)
            {
-             if (!tilepro_elf_create_got_section (htab->elf.dynobj, info))
+             if (!tilepro_elf_create_got_section (htab->dynobj, info))
                return FALSE;
            }
          break;
@@ -1716,7 +1708,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
              if (sreloc == NULL)
                {
                  sreloc = _bfd_elf_make_dynamic_reloc_section
-                   (sec, htab->elf.dynobj, 2, abfd, /*rela?*/ TRUE);
+                   (sec, htab->dynobj, 2, abfd, /*rela?*/ TRUE);
 
                  if (sreloc == NULL)
                    return FALSE;
@@ -1754,7 +1746,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
                {
                  size_t amt = sizeof *p;
                  p = ((struct elf_dyn_relocs *)
-                      bfd_alloc (htab->elf.dynobj, amt));
+                      bfd_alloc (htab->dynobj, amt));
                  if (p == NULL)
                    return FALSE;
                  p->next = *head;
@@ -1850,14 +1842,14 @@ static bfd_boolean
 tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
                                   struct elf_link_hash_entry *h)
 {
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
   asection *s, *srel;
 
   htab = tilepro_elf_hash_table (info);
   BFD_ASSERT (htab != NULL);
 
   /* Make sure we know what is going on here.  */
-  BFD_ASSERT (htab->elf.dynobj != NULL
+  BFD_ASSERT (htab->dynobj != NULL
              && (h->needs_plt
                  || h->is_weakalias
                  || (h->def_dynamic
@@ -1947,13 +1939,13 @@ tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
      .rel.bss section we are going to use.  */
   if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
     {
-      s = htab->elf.sdynrelro;
-      srel = htab->elf.sreldynrelro;
+      s = htab->sdynrelro;
+      srel = htab->sreldynrelro;
     }
   else
     {
-      s = htab->elf.sdynbss;
-      srel = htab->elf.srelbss;
+      s = htab->sdynbss;
+      srel = htab->srelbss;
     }
   if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
     {
@@ -1971,7 +1963,7 @@ static bfd_boolean
 allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 {
   struct bfd_link_info *info;
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
   struct elf_dyn_relocs *p;
 
   if (h->root.type == bfd_link_hash_indirect)
@@ -1981,7 +1973,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
   htab = tilepro_elf_hash_table (info);
   BFD_ASSERT (htab != NULL);
 
-  if (htab->elf.dynamic_sections_created
+  if (htab->dynamic_sections_created
       && h->plt.refcount > 0)
     {
       /* Make sure this symbol is output as a dynamic symbol.
@@ -1995,7 +1987,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 
       if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
        {
-         asection *s = htab->elf.splt;
+         asection *s = htab->splt;
 
          /* Allocate room for the header.  */
          if (s->size == 0)
@@ -2021,10 +2013,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
          s->size += PLT_ENTRY_SIZE;
 
          /* We also need to make an entry in the .got.plt section.  */
-         htab->elf.sgotplt->size += GOT_ENTRY_SIZE;
+         htab->sgotplt->size += GOT_ENTRY_SIZE;
 
          /* We also need to make an entry in the .rela.plt section.  */
-         htab->elf.srelplt->size += TILEPRO_ELF_RELA_BYTES;
+         htab->srelplt->size += TILEPRO_ELF_RELA_BYTES;
        }
       else
        {
@@ -2060,22 +2052,22 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
            return FALSE;
        }
 
-      s = htab->elf.sgot;
+      s = htab->sgot;
       h->got.offset = s->size;
       s->size += TILEPRO_BYTES_PER_WORD;
       /* R_TILEPRO_IMM16_Xn_TLS_GD entries need 2 consecutive GOT slots. */
       if (tls_type == GOT_TLS_GD)
        s->size += TILEPRO_BYTES_PER_WORD;
-      dyn = htab->elf.dynamic_sections_created;
+      dyn = htab->dynamic_sections_created;
       /* R_TILEPRO_IMM16_Xn_TLS_IE_xxx needs one dynamic relocation,
         R_TILEPRO_IMM16_Xn_TLS_GD_xxx needs two if local symbol and two if
         global.  */
       if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE)
-       htab->elf.srelgot->size += 2 * TILEPRO_ELF_RELA_BYTES;
+       htab->srelgot->size += 2 * TILEPRO_ELF_RELA_BYTES;
       else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
                                                bfd_link_pic (info),
                                                h))
-       htab->elf.srelgot->size += TILEPRO_ELF_RELA_BYTES;
+       htab->srelgot->size += TILEPRO_ELF_RELA_BYTES;
     }
   else
     h->got.offset = (bfd_vma) -1;
@@ -2134,7 +2126,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
       if (!h->non_got_ref
          && ((h->def_dynamic
               && !h->def_regular)
-             || (htab->elf.dynamic_sections_created
+             || (htab->dynamic_sections_created
                  && (h->root.type == bfd_link_hash_undefweak
                      || h->root.type == bfd_link_hash_undefined))))
        {
@@ -2195,14 +2187,14 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
 {
   (void)output_bfd;
 
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
   bfd *dynobj;
   asection *s;
   bfd *ibfd;
 
   htab = tilepro_elf_hash_table (info);
   BFD_ASSERT (htab != NULL);
-  dynobj = htab->elf.dynobj;
+  dynobj = htab->dynobj;
   BFD_ASSERT (dynobj != NULL);
 
   if (elf_hash_table (info)->dynamic_sections_created)
@@ -2268,8 +2260,8 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
       locsymcount = symtab_hdr->sh_info;
       end_local_got = local_got + locsymcount;
       local_tls_type = _bfd_tilepro_elf_local_got_tls_type (ibfd);
-      s = htab->elf.sgot;
-      srel = htab->elf.srelgot;
+      s = htab->sgot;
+      srel = htab->srelgot;
       for (; local_got < end_local_got; ++local_got, ++local_tls_type)
        {
          if (*local_got > 0)
@@ -2290,19 +2282,19 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
 
   /* Allocate global sym .plt and .got entries, and space for global
      sym dynamic relocs.  */
-  elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info);
+  elf_link_hash_traverse (htab, allocate_dynrelocs, info);
 
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       /* If the .got section is more than 0x8000 bytes, we add
         0x8000 to the value of _GLOBAL_OFFSET_TABLE_, so that 16
         bit relocations have a greater chance of working. */
-      if (htab->elf.sgot->size >= 0x8000
+      if (htab->sgot->size >= 0x8000
          && elf_hash_table (info)->hgot->root.u.def.value == 0)
        elf_hash_table (info)->hgot->root.u.def.value = 0x8000;
     }
 
-  if (htab->elf.sgotplt)
+  if (htab->sgotplt)
     {
       struct elf_link_hash_entry *got;
       got = elf_link_hash_lookup (elf_hash_table (info),
@@ -2313,14 +2305,14 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
         entries and there is no refeence to _GLOBAL_OFFSET_TABLE_.  */
       if ((got == NULL
           || !got->ref_regular_nonweak)
-         && (htab->elf.sgotplt->size
+         && (htab->sgotplt->size
              == GOTPLT_HEADER_SIZE)
-         && (htab->elf.splt == NULL
-             || htab->elf.splt->size == 0)
-         && (htab->elf.sgot == NULL
-             || (htab->elf.sgot->size
+         && (htab->splt == NULL
+             || htab->splt->size == 0)
+         && (htab->sgot == NULL
+             || (htab->sgot->size
                  == get_elf_backend_data (output_bfd)->got_header_size)))
-       htab->elf.sgotplt->size = 0;
+       htab->sgotplt->size = 0;
     }
 
   /* The check_relocs and adjust_dynamic_symbol entry points have
@@ -2331,11 +2323,11 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
       if ((s->flags & SEC_LINKER_CREATED) == 0)
        continue;
 
-      if (s == htab->elf.splt
-         || s == htab->elf.sgot
-         || s == htab->elf.sgotplt
-         || s == htab->elf.sdynbss
-         || s == htab->elf.sdynrelro)
+      if (s == htab->splt
+         || s == htab->sgot
+         || s == htab->sgotplt
+         || s == htab->sdynbss
+         || s == htab->sdynrelro)
        {
          /* Strip this section if we don't need it; see the
             comment below.  */
@@ -2381,51 +2373,7 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
        return FALSE;
     }
 
-  if (elf_hash_table (info)->dynamic_sections_created)
-    {
-      /* Add some entries to the .dynamic section.  We fill in the
-        values later, in tilepro_elf_finish_dynamic_sections, but we
-        must add the entries now so that we get the correct size for
-        the .dynamic section.  The DT_DEBUG entry is filled in by the
-        dynamic linker and used by the debugger.  */
-#define add_dynamic_entry(TAG, VAL) \
-  _bfd_elf_add_dynamic_entry (info, TAG, VAL)
-
-      if (bfd_link_executable (info))
-       {
-         if (!add_dynamic_entry (DT_DEBUG, 0))
-           return FALSE;
-       }
-
-      if (htab->elf.srelplt->size != 0)
-       {
-         if (!add_dynamic_entry (DT_PLTGOT, 0)
-             || !add_dynamic_entry (DT_PLTRELSZ, 0)
-             || !add_dynamic_entry (DT_PLTREL, DT_RELA)
-             || !add_dynamic_entry (DT_JMPREL, 0))
-           return FALSE;
-       }
-
-      if (!add_dynamic_entry (DT_RELA, 0)
-         || !add_dynamic_entry (DT_RELASZ, 0)
-         || !add_dynamic_entry (DT_RELAENT, TILEPRO_ELF_RELA_BYTES))
-       return FALSE;
-
-      /* If any dynamic relocs apply to a read-only section,
-        then we need a DT_TEXTREL entry.  */
-      if ((info->flags & DF_TEXTREL) == 0)
-       elf_link_hash_traverse (&htab->elf,
-                               _bfd_elf_maybe_set_textrel, info);
-
-      if (info->flags & DF_TEXTREL)
-       {
-         if (!add_dynamic_entry (DT_TEXTREL, 0))
-           return FALSE;
-       }
-    }
-#undef add_dynamic_entry
-
-  return TRUE;
+  return _bfd_elf_add_dynamic_tags (output_bfd, info, TRUE);
 }
 \f
 /* Return the base VMA address which should be subtracted from real addresses
@@ -2571,7 +2519,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                              Elf_Internal_Sym *local_syms,
                              asection **local_sections)
 {
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
   bfd_vma *local_got_offsets;
@@ -2802,7 +2750,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
        case R_TILEPRO_IMM16_X1_GOT_HA:
          /* Relocation is to the entry for this symbol in the global
             offset table.  */
-         if (htab->elf.sgot == NULL)
+         if (htab->sgot == NULL)
            abort ();
 
          if (h != NULL)
@@ -2836,7 +2784,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                  else
                    {
                      bfd_put_32 (output_bfd, relocation,
-                                         htab->elf.sgot->contents + off);
+                                         htab->sgot->contents + off);
                      h->got.offset |= 1;
                    }
                }
@@ -2864,11 +2812,11 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 
                      /* We need to generate a R_TILEPRO_RELATIVE reloc
                         for the dynamic linker.  */
-                     s = htab->elf.srelgot;
+                     s = htab->srelgot;
                      BFD_ASSERT (s != NULL);
 
-                     outrel.r_offset = (htab->elf.sgot->output_section->vma
-                                        + htab->elf.sgot->output_offset
+                     outrel.r_offset = (htab->sgot->output_section->vma
+                                        + htab->sgot->output_offset
                                         + off);
                      outrel.r_info = ELF32_R_INFO (0, R_TILEPRO_RELATIVE);
                      outrel.r_addend = relocation;
@@ -2877,7 +2825,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                    }
 
                  bfd_put_32 (output_bfd, relocation,
-                                     htab->elf.sgot->contents + off);
+                                     htab->sgot->contents + off);
                  local_got_offsets[r_symndx] |= 1;
                }
            }
@@ -2889,7 +2837,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
             procedure linkage table.  */
          BFD_ASSERT (h != NULL);
 
-         if (h->plt.offset == (bfd_vma) -1 || htab->elf.splt == NULL)
+         if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL)
            {
              /* We didn't make a PLT entry for this symbol.  This
                 happens when statically linking PIC code, or when
@@ -2897,8 +2845,8 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
              break;
            }
 
-         relocation = (htab->elf.splt->output_section->vma
-                       + htab->elf.splt->output_offset
+         relocation = (htab->splt->output_section->vma
+                       + htab->splt->output_offset
                        + h->plt.offset);
          unresolved_reloc = FALSE;
          break;
@@ -3037,7 +2985,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                      outrel.r_addend = relocation + rel->r_addend;
 
                      if (is_plt)
-                       sec = htab->elf.splt;
+                       sec = htab->splt;
 
                      if (bfd_is_abs_section (sec))
                        indx = 0;
@@ -3060,7 +3008,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 
                          if (indx == 0)
                            {
-                             osec = htab->elf.text_index_section;
+                             osec = htab->text_index_section;
                              indx = elf_section_data (osec)->dynindx;
                            }
 
@@ -3186,7 +3134,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
              local_got_offsets[r_symndx] |= 1;
            }
 
-         if (htab->elf.sgot == NULL)
+         if (htab->sgot == NULL)
            abort ();
 
          if ((off & 1) != 0)
@@ -3197,13 +3145,13 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
              int indx = 0;
              bfd_boolean need_relocs = FALSE;
 
-             if (htab->elf.srelgot == NULL)
+             if (htab->srelgot == NULL)
                abort ();
 
              if (h != NULL)
              {
                bfd_boolean dyn;
-               dyn = htab->elf.dynamic_sections_created;
+               dyn = htab->dynamic_sections_created;
 
                if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
                                                     bfd_link_pic (info),
@@ -3234,18 +3182,18 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                  case R_TILEPRO_IMM16_X0_TLS_IE_HA:
                  case R_TILEPRO_IMM16_X1_TLS_IE_HA:
                    if (need_relocs) {
-                     bfd_put_32 (output_bfd, 0, htab->elf.sgot->contents + off);
-                     outrel.r_offset = (htab->elf.sgot->output_section->vma
-                                      + htab->elf.sgot->output_offset + off);
+                     bfd_put_32 (output_bfd, 0, htab->sgot->contents + off);
+                     outrel.r_offset = (htab->sgot->output_section->vma
+                                      + htab->sgot->output_offset + off);
                      outrel.r_addend = 0;
                      if (indx == 0)
                        outrel.r_addend = relocation - dtpoff_base (info);
                      outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_TPOFF32);
-                     tilepro_elf_append_rela_32 (output_bfd, htab->elf.srelgot,
+                     tilepro_elf_append_rela_32 (output_bfd, htab->srelgot,
                                                  &outrel);
                    } else {
                      bfd_put_32 (output_bfd, tpoff (info, relocation),
-                                 htab->elf.sgot->contents + off);
+                                 htab->sgot->contents + off);
                    }
                    break;
 
@@ -3258,31 +3206,31 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                  case R_TILEPRO_IMM16_X0_TLS_GD_HA:
                  case R_TILEPRO_IMM16_X1_TLS_GD_HA:
                    if (need_relocs) {
-                     outrel.r_offset = (htab->elf.sgot->output_section->vma
-                                      + htab->elf.sgot->output_offset + off);
+                     outrel.r_offset = (htab->sgot->output_section->vma
+                                      + htab->sgot->output_offset + off);
                      outrel.r_addend = 0;
                      outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_DTPMOD32);
-                     bfd_put_32 (output_bfd, 0, htab->elf.sgot->contents + off);
-                     tilepro_elf_append_rela_32 (output_bfd, htab->elf.srelgot,
+                     bfd_put_32 (output_bfd, 0, htab->sgot->contents + off);
+                     tilepro_elf_append_rela_32 (output_bfd, htab->srelgot,
                                                  &outrel);
                      if (indx == 0)
                        {
                          BFD_ASSERT (! unresolved_reloc);
                          bfd_put_32 (output_bfd,
                                      relocation - dtpoff_base (info),
-                                     (htab->elf.sgot->contents + off +
+                                     (htab->sgot->contents + off +
                                       TILEPRO_BYTES_PER_WORD));
                        }
                      else
                        {
                          bfd_put_32 (output_bfd, 0,
-                                     (htab->elf.sgot->contents + off +
+                                     (htab->sgot->contents + off +
                                       TILEPRO_BYTES_PER_WORD));
                          outrel.r_info = ELF32_R_INFO (indx,
                                                        R_TILEPRO_TLS_DTPOFF32);
                          outrel.r_offset += TILEPRO_BYTES_PER_WORD;
                          tilepro_elf_append_rela_32 (output_bfd,
-                                                     htab->elf.srelgot, &outrel);
+                                                     htab->srelgot, &outrel);
                        }
                    }
 
@@ -3293,9 +3241,9 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                         symbol binding locally.  Mark it as belonging
                         to module 1, the executable.  */
                      bfd_put_32 (output_bfd, 1,
-                                 htab->elf.sgot->contents + off );
+                                 htab->sgot->contents + off );
                      bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
-                                 htab->elf.sgot->contents + off +
+                                 htab->sgot->contents + off +
                                  TILEPRO_BYTES_PER_WORD);
                   }
                   break;
@@ -3455,7 +3403,7 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
                                   struct elf_link_hash_entry *h,
                                   Elf_Internal_Sym *sym)
 {
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
 
   htab = tilepro_elf_hash_table (info);
   BFD_ASSERT (htab != NULL);
@@ -3475,9 +3423,9 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
 
       BFD_ASSERT (h->dynindx != -1);
 
-      splt = htab->elf.splt;
-      srela = htab->elf.srelplt;
-      sgotplt = htab->elf.sgotplt;
+      splt = htab->splt;
+      srela = htab->srelplt;
+      sgotplt = htab->sgotplt;
 
       if (splt == NULL || srela == NULL)
        abort ();
@@ -3525,8 +3473,8 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
 
       /* This symbol has an entry in the GOT.  Set it up.  */
 
-      sgot = htab->elf.sgot;
-      srela = htab->elf.srelgot;
+      sgot = htab->sgot;
+      srela = htab->srelgot;
       BFD_ASSERT (sgot != NULL && srela != NULL);
 
       rela.r_offset = (sgot->output_section->vma
@@ -3572,16 +3520,16 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
                       + h->root.u.def.section->output_offset);
       rela.r_info = ELF32_R_INFO (h->dynindx, R_TILEPRO_COPY);
       rela.r_addend = 0;
-      if (h->root.u.def.section == htab->elf.sdynrelro)
-       s = htab->elf.sreldynrelro;
+      if (h->root.u.def.section == htab->sdynrelro)
+       s = htab->sreldynrelro;
       else
-       s = htab->elf.srelbss;
+       s = htab->srelbss;
       tilepro_elf_append_rela_32 (output_bfd, s, &rela);
     }
 
   /* Mark some specially defined symbols as absolute. */
-  if (h == htab->elf.hdynamic
-      || (h == htab->elf.hgot || h == htab->elf.hplt))
+  if (h == htab->hdynamic
+      || (h == htab->hgot || h == htab->hplt))
     sym->st_shndx = SHN_ABS;
 
   return TRUE;
@@ -3595,7 +3543,7 @@ tilepro_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
                    asection *splt ATTRIBUTE_UNUSED)
 {
   Elf32_External_Dyn *dyncon, *dynconend;
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
 
   htab = tilepro_elf_hash_table (info);
   BFD_ASSERT (htab != NULL);
@@ -3611,15 +3559,15 @@ tilepro_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
       switch (dyn.d_tag)
        {
        case DT_PLTGOT:
-         s = htab->elf.sgotplt;
+         s = htab->sgotplt;
          dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
          break;
        case DT_JMPREL:
-         s = htab->elf.srelplt;
+         s = htab->srelplt;
          dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
          break;
        case DT_PLTRELSZ:
-         s = htab->elf.srelplt;
+         s = htab->srelplt;
          dyn.d_un.d_val = s->size;
          break;
        default:
@@ -3637,11 +3585,11 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd,
 {
   bfd *dynobj;
   asection *sdyn;
-  struct tilepro_elf_link_hash_table *htab;
+  struct elf_link_hash_table *htab;
 
   htab = tilepro_elf_hash_table (info);
   BFD_ASSERT (htab != NULL);
-  dynobj = htab->elf.dynobj;
+  dynobj = htab->dynobj;
 
   sdyn = bfd_get_linker_section (dynobj, ".dynamic");
 
@@ -3650,7 +3598,7 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd,
       asection *splt;
       bfd_boolean ret;
 
-      splt = htab->elf.splt;
+      splt = htab->splt;
       BFD_ASSERT (splt != NULL && sdyn != NULL);
 
       ret = tilepro_finish_dyn (output_bfd, info, dynobj, sdyn, splt);
@@ -3671,42 +3619,42 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd,
          = PLT_ENTRY_SIZE;
     }
 
-  if (htab->elf.sgotplt)
+  if (htab->sgotplt)
     {
-      if (bfd_is_abs_section (htab->elf.sgotplt->output_section))
+      if (bfd_is_abs_section (htab->sgotplt->output_section))
        {
          _bfd_error_handler
-           (_("discarded output section: `%pA'"), htab->elf.sgotplt);
+           (_("discarded output section: `%pA'"), htab->sgotplt);
          return FALSE;
        }
 
-      if (htab->elf.sgotplt->size > 0)
+      if (htab->sgotplt->size > 0)
        {
          /* Write the first two entries in .got.plt, needed for the dynamic
             linker.  */
          bfd_put_32 (output_bfd, (bfd_vma) -1,
-                     htab->elf.sgotplt->contents);
+                     htab->sgotplt->contents);
          bfd_put_32 (output_bfd, (bfd_vma) 0,
-                     htab->elf.sgotplt->contents + GOT_ENTRY_SIZE);
+                     htab->sgotplt->contents + GOT_ENTRY_SIZE);
        }
 
-      elf_section_data (htab->elf.sgotplt->output_section)->this_hdr.sh_entsize
+      elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize
        = GOT_ENTRY_SIZE;
     }
 
-  if (htab->elf.sgot)
+  if (htab->sgot)
     {
-      if (htab->elf.sgot->size > 0)
+      if (htab->sgot->size > 0)
        {
          /* Set the first entry in the global offset table to the address of
             the dynamic section.  */
          bfd_vma val = (sdyn ?
                         sdyn->output_section->vma + sdyn->output_offset :
                         0);
-         bfd_put_32 (output_bfd, val, htab->elf.sgot->contents);
+         bfd_put_32 (output_bfd, val, htab->sgot->contents);
        }
 
-      elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize
+      elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize
        = GOT_ENTRY_SIZE;
     }