aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-tilepro.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-07-30 03:41:30 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-07-30 03:41:44 -0700
commitf1dfbfdbc6c07a8ee4ea185a2f15615600857531 (patch)
treebf9191cd8e6d39ac0a0aaf6d2ff945660feec1d0 /bfd/elf32-tilepro.c
parent6cc64caabac2f835149d0931d5ab689ccca1ca08 (diff)
downloadgdb-f1dfbfdbc6c07a8ee4ea185a2f15615600857531.zip
gdb-f1dfbfdbc6c07a8ee4ea185a2f15615600857531.tar.gz
gdb-f1dfbfdbc6c07a8ee4ea185a2f15615600857531.tar.bz2
elf: Add sym_cache to elf_link_hash_table
Since many ELF backends have sym_cache to their link hash tables, add sym_cache to elf_link_hash_table. Also use sdynbss and srelbss in elf_link_hash_table. * elf-bfd.h (sym_cache): Moved before elf_link_hash_table. (elf_link_hash_table): Add sym_cache. * elf32-arm.c (elf32_arm_link_hash_table): Remove sym_cache. (elf32_arm_check_relocs): Updated. (elf32_arm_size_dynamic_sections): Likewise. * elf32-bfin.c (bfin_link_hash_table): Removed. (bfin_link_hash_newfunc): Updated. (bfin_hash_table): Removed. * elf32-csky.c (csky_elf_link_hash_table): Remove sym_cache. (csky_elf_check_relocs): Updated. * elf32-hppa.c (elf32_hppa_link_hash_table): Remove sym_cache. (elf32_hppa_check_relocs): Updated. * elf32-i386.c (elf_i386_tls_transition): Updated. (elf_i386_convert_load_reloc): Likewise. (elf_i386_check_relocs): Likewise. * elf32-m32r.c (elf_m32r_link_hash_table): Removed. (m32r_elf_hash_table): Updated. (m32r_elf_link_hash_table_create): Likewise. (m32r_elf_create_dynamic_sections): Likewise. (m32r_elf_adjust_dynamic_symbol): Likewise. (allocate_dynrelocs): Likewise. (m32r_elf_size_dynamic_sections): Likewise. (m32r_elf_relocate_section): Likewise. (m32r_elf_finish_dynamic_symbol): Likewise. (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.h (m68hc11_elf_link_hash_table): Remove sym_cache. * elf32-m68k.c (elf_m68k_link_hash_table): Likewise. (elf_m68k_check_relocs): Updated. * elf32-metag.c (elf_metag_link_hash_table): Remove sym_cache. (elf_metag_check_relocs): Updated. * elf32-microblaze.c (elf32_mb_link_hash_table): Remove sym_sec. (microblaze_elf_check_relocs): Updated. * elf32-nds32.c (nds32_elf_link_hash_table_create): Likewise. (nds32_elf_create_dynamic_sections): Likewise. (nds32_elf_adjust_dynamic_symbol): Likewise. (nds32_elf_check_relocs): Likewise. * elf32-nds32.h (elf_nds32_link_hash_table): Remove sdynbss, srelbss and aym_cache. * elf32-nios2.c (elf32_nios2_link_hash_table): Remove sym_cache. (nios2_elf32_check_relocs): Updated. * elf32-or1k.c (elf_or1k_link_hash_table): Remove sym_sec. (or1k_elf_check_relocs): Updated. * elf32-ppc.c (ppc_elf_check_relocs): Remove sym_cache. (ppc_elf_check_relocs): Updated. * elf32-s390.c (elf_s390_link_hash_table): Remove sym_cache. (elf_s390_check_relocs): Updated. (elf_s390_finish_dynamic_sections): Likewise. * elf32-sh.c (elf_sh_link_hash_table): Remove sdynbss, srelbss and aym_cache. (sh_elf_create_dynamic_sections): Updated. (sh_elf_adjust_dynamic_symbol): Likewise. (sh_elf_size_dynamic_sections): Likewise. (sh_elf_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_link_hash_table): Remove sym_cache. (elf32_tic6x_check_relocs): Updated. * elf32-tilepro.c (tilepro_elf_link_hash_table): Removed. (tilepro_elf_hash_table): Updated. (tilepro_elf_link_hash_table_create): Likewise. (tilepro_elf_check_relocs): Likewise. (tilepro_elf_adjust_dynamic_symbol): Likewise. (allocate_dynrelocs): Likewise. (tilepro_elf_size_dynamic_sections): Likewise. (tilepro_elf_relocate_section): Likewise. (tilepro_elf_finish_dynamic_symbol): Likewise. (tilepro_finish_dyn): Likewise. (tilepro_elf_finish_dynamic_sections): Likewise. * elf64-ppc.c (ppc_link_hash_table): Remove sym_cache. (ppc64_elf_before_check_relocs): Updated. (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_link_hash_table): Remove sym_cache. (elf_s390_check_relocs): Updated. (elf_s390_relocate_section): Likewise. (elf_s390_finish_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise. (elf_x86_64_check_relocs): Likewise. * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove sym_cache. (elfNN_aarch64_check_relocs): Updated. * elfnn-riscv.c (riscv_elf_link_hash_table): Remove sym_cache. (riscv_elf_check_relocs): Updated. * elfxx-mips.c (mips_elf_link_hash_table): Remove sym_cache. (mips_elf_resolve_got_page_ref): Updated. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove sym_cache. * elfxx-tilegx.c (tilegx_elf_link_hash_table): Likewise. (tilegx_elf_check_relocs): Updated. * elfxx-x86.h (elf_x86_link_hash_table): Remove sym_cache.
Diffstat (limited to 'bfd/elf32-tilepro.c')
-rw-r--r--bfd/elf32-tilepro.c218
1 files changed, 105 insertions, 113 deletions
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index 5b3e80a..e062dc0 100644
--- a/bfd/elf32-tilepro.c
+++ b/bfd/elf32-tilepro.c
@@ -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)
+ ? ((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. */
@@ -2527,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;
@@ -2758,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)
@@ -2792,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;
}
}
@@ -2820,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;
@@ -2833,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;
}
}
@@ -2845,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
@@ -2853,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;
@@ -2993,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;
@@ -3016,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;
}
@@ -3142,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)
@@ -3153,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),
@@ -3190,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;
@@ -3214,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);
}
}
@@ -3249,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;
@@ -3411,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);
@@ -3431,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 ();
@@ -3481,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
@@ -3528,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;
@@ -3551,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);
@@ -3567,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:
@@ -3593,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");
@@ -3606,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);
@@ -3627,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;
}