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.
This commit is contained in:
H.J. Lu 2020-07-30 03:41:30 -07:00
parent 6cc64caaba
commit f1dfbfdbc6
31 changed files with 326 additions and 340 deletions

View File

@ -1,3 +1,95 @@
2020-07-30 H.J. Lu <hongjiu.lu@intel.com>
* 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.
2020-07-29 Maciej W. Rozycki <macro@linux-mips.org> 2020-07-29 Maciej W. Rozycki <macro@linux-mips.org>
* elflink.c (bfd_elf_final_link): Give local symbols a name if * elflink.c (bfd_elf_final_link): Give local symbols a name if

View File

@ -549,6 +549,16 @@ enum elf_target_os
is_nacl /* Native Client. */ is_nacl /* Native Client. */
}; };
/* Used by bfd_sym_from_r_symndx to cache a small number of local
symbols. */
#define LOCAL_SYM_CACHE_SIZE 32
struct sym_cache
{
bfd *abfd;
unsigned long indx[LOCAL_SYM_CACHE_SIZE];
Elf_Internal_Sym sym[LOCAL_SYM_CACHE_SIZE];
};
/* ELF linker hash table. */ /* ELF linker hash table. */
struct elf_link_hash_table struct elf_link_hash_table
@ -676,6 +686,9 @@ struct elf_link_hash_table
/* A linked list of dynamic BFD's loaded in the link. */ /* A linked list of dynamic BFD's loaded in the link. */
struct elf_link_loaded_list *dyn_loaded; struct elf_link_loaded_list *dyn_loaded;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* Short-cuts to get to dynamic linker sections. */ /* Short-cuts to get to dynamic linker sections. */
asection *sgot; asection *sgot;
asection *sgotplt; asection *sgotplt;
@ -717,16 +730,6 @@ struct elf_link_hash_table
/* Returns TRUE if the hash table is a struct elf_link_hash_table. */ /* Returns TRUE if the hash table is a struct elf_link_hash_table. */
#define is_elf_hash_table(htab) \ #define is_elf_hash_table(htab) \
(((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table) (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
/* Used by bfd_sym_from_r_symndx to cache a small number of local
symbols. */
#define LOCAL_SYM_CACHE_SIZE 32
struct sym_cache
{
bfd *abfd;
unsigned long indx[LOCAL_SYM_CACHE_SIZE];
Elf_Internal_Sym sym[LOCAL_SYM_CACHE_SIZE];
};
/* Constant information held for an ELF backend. */ /* Constant information held for an ELF backend. */

View File

@ -3390,9 +3390,6 @@ struct elf32_arm_link_hash_table
bfd_vma offset; bfd_vma offset;
} tls_ldm_got; } tls_ldm_got;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* For convenience in allocate_dynrelocs. */ /* For convenience in allocate_dynrelocs. */
bfd * obfd; bfd * obfd;
@ -15316,7 +15313,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -16871,7 +16868,8 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
s->size += 4; s->size += 4;
} }
isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, symndx); isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, ibfd,
symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -4791,16 +4791,6 @@ struct bfin_link_hash_entry
struct bfin_pcrel_relocs_copied *pcrel_relocs_copied; struct bfin_pcrel_relocs_copied *pcrel_relocs_copied;
}; };
/* bfin ELF linker hash table. */
struct bfin_link_hash_table
{
struct elf_link_hash_table root;
/* Small local sym cache. */
struct sym_cache sym_cache;
};
#define bfin_hash_entry(ent) ((struct bfin_link_hash_entry *) (ent)) #define bfin_hash_entry(ent) ((struct bfin_link_hash_entry *) (ent))
static struct bfd_hash_entry * static struct bfd_hash_entry *
@ -4829,15 +4819,14 @@ bfin_link_hash_newfunc (struct bfd_hash_entry *entry,
static struct bfd_link_hash_table * static struct bfd_link_hash_table *
bfin_link_hash_table_create (bfd * abfd) bfin_link_hash_table_create (bfd * abfd)
{ {
struct bfin_link_hash_table *ret; struct elf_link_hash_table *ret;
size_t amt = sizeof (struct bfin_link_hash_table); size_t amt = sizeof (struct elf_link_hash_table);
ret = bfd_zmalloc (amt); ret = bfd_zmalloc (amt);
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, if (!_bfd_elf_link_hash_table_init (ret, abfd, bfin_link_hash_newfunc,
bfin_link_hash_newfunc,
sizeof (struct elf_link_hash_entry), sizeof (struct elf_link_hash_entry),
BFIN_ELF_DATA)) BFIN_ELF_DATA))
{ {
@ -4845,9 +4834,7 @@ bfin_link_hash_table_create (bfd * abfd)
return NULL; return NULL;
} }
ret->sym_cache.abfd = NULL; return &ret->root;
return &ret->root.root;
} }
/* The size in bytes of an entry in the procedure linkage table. */ /* The size in bytes of an entry in the procedure linkage table. */
@ -5418,10 +5405,6 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] =
#define bfd_elf32_bfd_is_local_label_name \ #define bfd_elf32_bfd_is_local_label_name \
bfin_is_local_label_name bfin_is_local_label_name
#define bfin_hash_table(p) \
((struct bfin_link_hash_table *) (p)->hash)
#define elf_backend_create_dynamic_sections \ #define elf_backend_create_dynamic_sections \
_bfd_elf_create_dynamic_sections _bfd_elf_create_dynamic_sections

View File

@ -1208,9 +1208,6 @@ struct csky_elf_link_hash_table
{ {
struct elf_link_hash_table elf; struct elf_link_hash_table elf;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* Data for R_CKCORE_TLS_LDM32 relocations. */ /* Data for R_CKCORE_TLS_LDM32 relocations. */
union union
{ {
@ -2477,7 +2474,7 @@ csky_elf_check_relocs (bfd * abfd,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -2584,7 +2581,7 @@ csky_elf_check_relocs (bfd * abfd,
asection *s; asection *s;
Elf_Internal_Sym *loc_isym; Elf_Internal_Sym *loc_isym;
loc_isym = bfd_sym_from_r_symndx (&htab->sym_cache, loc_isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (loc_isym == NULL) if (loc_isym == NULL)
return FALSE; return FALSE;

View File

@ -286,9 +286,6 @@ struct elf32_hppa_link_hash_table
/* Set if we need a .plt stub to support lazy dynamic linking. */ /* Set if we need a .plt stub to support lazy dynamic linking. */
unsigned int need_plt_stub:1; unsigned int need_plt_stub:1;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* Data for LDM relocations. */ /* Data for LDM relocations. */
union union
{ {
@ -1465,7 +1462,7 @@ elf32_hppa_check_relocs (bfd *abfd,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->etab.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -4038,7 +4035,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
else else
{ {
Elf_Internal_Sym *isym Elf_Internal_Sym *isym
= bfd_sym_from_r_symndx (&htab->sym_cache, = bfd_sym_from_r_symndx (&htab->etab.sym_cache,
input_bfd, r_symndx); input_bfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -1158,7 +1158,7 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
{ {
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL); name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
} }
@ -1251,7 +1251,7 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
else else
{ {
local_ref = TRUE; local_ref = TRUE;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, abfd,
r_symndx); r_symndx);
abs_symbol = isym->st_shndx == SHN_ABS; abs_symbol = isym->st_shndx == SHN_ABS;
} }
@ -1529,7 +1529,7 @@ elf_i386_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
goto error_return; goto error_return;
@ -1859,7 +1859,7 @@ elf_i386_check_relocs (bfd *abfd,
void **vpp; void **vpp;
asection *s; asection *s;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
goto error_return; goto error_return;

View File

@ -1498,20 +1498,6 @@ struct elf_m32r_pcrel_relocs_copied
bfd_size_type count; bfd_size_type count;
}; };
/* m32r ELF linker hash table. */
struct elf_m32r_link_hash_table
{
struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Small local sym cache. */
struct sym_cache sym_cache;
};
/* Traverse an m32r ELF linker hash table. */ /* Traverse an m32r ELF linker hash table. */
#define m32r_elf_link_hash_traverse(table, func, info) \ #define m32r_elf_link_hash_traverse(table, func, info) \
@ -1524,21 +1510,21 @@ struct elf_m32r_link_hash_table
#define m32r_elf_hash_table(p) \ #define m32r_elf_hash_table(p) \
(elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
== M32R_ELF_DATA ? ((struct elf_m32r_link_hash_table *) ((p)->hash)) : NULL) == M32R_ELF_DATA ? ((struct elf_link_hash_table *) ((p)->hash)) : NULL)
/* Create an m32r ELF linker hash table. */ /* Create an m32r ELF linker hash table. */
static struct bfd_link_hash_table * static struct bfd_link_hash_table *
m32r_elf_link_hash_table_create (bfd *abfd) m32r_elf_link_hash_table_create (bfd *abfd)
{ {
struct elf_m32r_link_hash_table *ret; struct elf_link_hash_table *ret;
size_t amt = sizeof (struct elf_m32r_link_hash_table); size_t amt = sizeof (struct elf_link_hash_table);
ret = bfd_zmalloc (amt); ret = bfd_zmalloc (amt);
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, if (!_bfd_elf_link_hash_table_init (ret, abfd,
_bfd_elf_link_hash_newfunc, _bfd_elf_link_hash_newfunc,
sizeof (struct elf_link_hash_entry), sizeof (struct elf_link_hash_entry),
M32R_ELF_DATA)) M32R_ELF_DATA))
@ -1547,7 +1533,7 @@ m32r_elf_link_hash_table_create (bfd *abfd)
return NULL; return NULL;
} }
return &ret->root.root; return &ret->root;
} }
/* Create dynamic sections when linking against a dynamic object. */ /* Create dynamic sections when linking against a dynamic object. */
@ -1555,7 +1541,7 @@ m32r_elf_link_hash_table_create (bfd *abfd)
static bfd_boolean static bfd_boolean
m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{ {
struct elf_m32r_link_hash_table *htab; struct elf_link_hash_table *htab;
flagword flags, pltflags; flagword flags, pltflags;
asection *s; asection *s;
const struct elf_backend_data *bed = get_elf_backend_data (abfd); const struct elf_backend_data *bed = get_elf_backend_data (abfd);
@ -1578,7 +1564,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
pltflags |= SEC_READONLY; pltflags |= SEC_READONLY;
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
htab->root.splt = s; htab->splt = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
@ -1598,7 +1584,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
h = (struct elf_link_hash_entry *) bh; h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1; h->def_regular = 1;
h->type = STT_OBJECT; h->type = STT_OBJECT;
htab->root.hplt = h; htab->hplt = h;
if (bfd_link_pic (info) if (bfd_link_pic (info)
&& ! bfd_elf_link_record_dynamic_symbol (info, h)) && ! bfd_elf_link_record_dynamic_symbol (info, h))
@ -1609,12 +1595,12 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
bed->default_use_rela_p bed->default_use_rela_p
? ".rela.plt" : ".rel.plt", ? ".rela.plt" : ".rel.plt",
flags | SEC_READONLY); flags | SEC_READONLY);
htab->root.srelplt = s; htab->srelplt = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (htab->root.sgot == NULL if (htab->sgot == NULL
&& !_bfd_elf_create_got_section (abfd, info)) && !_bfd_elf_create_got_section (abfd, info))
return FALSE; return FALSE;
@ -1669,7 +1655,7 @@ static bfd_boolean
m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info, m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h) struct elf_link_hash_entry *h)
{ {
struct elf_m32r_link_hash_table *htab; struct elf_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
asection *s; asection *s;
@ -1796,7 +1782,7 @@ static bfd_boolean
allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
{ {
struct bfd_link_info *info; struct bfd_link_info *info;
struct elf_m32r_link_hash_table *htab; struct elf_link_hash_table *htab;
struct elf_dyn_relocs *p; struct elf_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect) if (h->root.type == bfd_link_hash_indirect)
@ -1807,7 +1793,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
if (htab == NULL) if (htab == NULL)
return FALSE; return FALSE;
if (htab->root.dynamic_sections_created if (htab->dynamic_sections_created
&& h->plt.refcount > 0) && h->plt.refcount > 0)
{ {
/* Make sure this symbol is output as a dynamic symbol. /* Make sure this symbol is output as a dynamic symbol.
@ -1821,7 +1807,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h)) if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{ {
asection *s = htab->root.splt; asection *s = htab->splt;
/* If this is the first .plt entry, make room for the special /* If this is the first .plt entry, make room for the special
first entry. */ first entry. */
@ -1847,10 +1833,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* We also need to make an entry in the .got.plt section, which /* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */ will be placed in the .got section by the linker script. */
htab->root.sgotplt->size += 4; htab->sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */ /* We also need to make an entry in the .rel.plt section. */
htab->root.srelplt->size += sizeof (Elf32_External_Rela); htab->srelplt->size += sizeof (Elf32_External_Rela);
} }
else else
{ {
@ -1878,13 +1864,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
return FALSE; return FALSE;
} }
s = htab->root.sgot; s = htab->sgot;
h->got.offset = s->size; h->got.offset = s->size;
s->size += 4; s->size += 4;
dyn = htab->root.dynamic_sections_created; dyn = htab->dynamic_sections_created;
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h)) if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
htab->root.srelgot->size += sizeof (Elf32_External_Rela); htab->srelgot->size += sizeof (Elf32_External_Rela);
} }
else else
h->got.offset = (bfd_vma) -1; h->got.offset = (bfd_vma) -1;
@ -1944,7 +1930,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
if (!h->non_got_ref if (!h->non_got_ref
&& ((h->def_dynamic && ((h->def_dynamic
&& !h->def_regular) && !h->def_regular)
|| (htab->root.dynamic_sections_created || (htab->dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak && (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))) || h->root.type == bfd_link_hash_undefined))))
{ {
@ -1984,7 +1970,7 @@ static bfd_boolean
m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info) struct bfd_link_info *info)
{ {
struct elf_m32r_link_hash_table *htab; struct elf_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
asection *s; asection *s;
bfd_boolean relocs; bfd_boolean relocs;
@ -1998,10 +1984,10 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab == NULL) if (htab == NULL)
return FALSE; return FALSE;
dynobj = htab->root.dynobj; dynobj = htab->dynobj;
BFD_ASSERT (dynobj != NULL); BFD_ASSERT (dynobj != NULL);
if (htab->root.dynamic_sections_created) if (htab->dynamic_sections_created)
{ {
/* Set the contents of the .interp section to the interpreter. */ /* Set the contents of the .interp section to the interpreter. */
if (bfd_link_executable (info) && !info->nointerp) if (bfd_link_executable (info) && !info->nointerp)
@ -2060,8 +2046,8 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info; locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount; end_local_got = local_got + locsymcount;
s = htab->root.sgot; s = htab->sgot;
srel = htab->root.srelgot; srel = htab->srelgot;
for (; local_got < end_local_got; ++local_got) for (; local_got < end_local_got; ++local_got)
{ {
if (*local_got > 0) if (*local_got > 0)
@ -2078,7 +2064,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Allocate global sym .plt and .got entries, and space for global /* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */ sym dynamic relocs. */
elf_link_hash_traverse (&htab->root, allocate_dynrelocs, info); elf_link_hash_traverse (htab, allocate_dynrelocs, info);
/* We now have determined the sizes of the various dynamic sections. /* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */ Allocate memory for them. */
@ -2088,9 +2074,9 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if ((s->flags & SEC_LINKER_CREATED) == 0) if ((s->flags & SEC_LINKER_CREATED) == 0)
continue; continue;
if (s == htab->root.splt if (s == htab->splt
|| s == htab->root.sgot || s == htab->sgot
|| s == htab->root.sgotplt || s == htab->sgotplt
|| s == htab->sdynbss) || s == htab->sdynbss)
{ {
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
@ -2098,7 +2084,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (CONST_STRNEQ (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->root.srelplt) if (s->size != 0 && s != htab->srelplt)
relocs = TRUE; relocs = TRUE;
/* We use the reloc_count field as a counter if we need /* We use the reloc_count field as a counter if we need
@ -2188,7 +2174,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Rela *rel, *relend; Elf_Internal_Rela *rel, *relend;
/* Assume success. */ /* Assume success. */
bfd_boolean ret = TRUE; bfd_boolean ret = TRUE;
struct elf_m32r_link_hash_table *htab = m32r_elf_hash_table (info); struct elf_link_hash_table *htab = m32r_elf_hash_table (info);
bfd_vma *local_got_offsets; bfd_vma *local_got_offsets;
asection *sgot, *splt, *sreloc; asection *sgot, *splt, *sreloc;
bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section); bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section);
@ -2198,8 +2184,8 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
local_got_offsets = elf_local_got_offsets (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd);
sgot = htab->root.sgot; sgot = htab->sgot;
splt = htab->root.splt; splt = htab->splt;
sreloc = NULL; sreloc = NULL;
rel = relocs; rel = relocs;
@ -2295,7 +2281,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd_boolean dyn; bfd_boolean dyn;
sec = h->root.u.def.section; sec = h->root.u.def.section;
dyn = htab->root.dynamic_sections_created; dyn = htab->dynamic_sections_created;
sec = h->root.u.def.section; sec = h->root.u.def.section;
if (r_type == R_M32R_GOTPC24 if (r_type == R_M32R_GOTPC24
|| (r_type == R_M32R_GOTPC_HI_ULO || (r_type == R_M32R_GOTPC_HI_ULO
@ -2516,7 +2502,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
off = h->got.offset; off = h->got.offset;
BFD_ASSERT (off != (bfd_vma) -1); BFD_ASSERT (off != (bfd_vma) -1);
dyn = htab->root.dynamic_sections_created; dyn = htab->dynamic_sections_created;
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
bfd_link_pic (info), bfd_link_pic (info),
h) h)
@ -2576,7 +2562,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
/* We need to generate a R_M32R_RELATIVE reloc /* We need to generate a R_M32R_RELATIVE reloc
for the dynamic linker. */ for the dynamic linker. */
srelgot = htab->root.srelgot; srelgot = htab->srelgot;
BFD_ASSERT (srelgot != NULL); BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma outrel.r_offset = (sgot->output_section->vma
@ -2892,7 +2878,7 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
struct elf_link_hash_entry *h, struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym) Elf_Internal_Sym *sym)
{ {
struct elf_m32r_link_hash_table *htab; struct elf_link_hash_table *htab;
bfd_byte *loc; bfd_byte *loc;
#ifdef DEBUG_PIC #ifdef DEBUG_PIC
@ -2918,9 +2904,9 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
BFD_ASSERT (h->dynindx != -1); BFD_ASSERT (h->dynindx != -1);
splt = htab->root.splt; splt = htab->splt;
sgot = htab->root.sgotplt; sgot = htab->sgotplt;
srela = htab->root.srelplt; srela = htab->srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
/* Get the index in the procedure linkage table which /* Get the index in the procedure linkage table which
@ -3014,8 +3000,8 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
/* This symbol has an entry in the global offset table. Set it /* This symbol has an entry in the global offset table. Set it
up. */ up. */
sgot = htab->root.sgot; sgot = htab->sgot;
srela = htab->root.srelgot; srela = htab->srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL); BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma rela.r_offset = (sgot->output_section->vma
@ -3063,7 +3049,7 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
&& (h->root.type == bfd_link_hash_defined && (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)); || h->root.type == bfd_link_hash_defweak));
s = bfd_get_linker_section (htab->root.dynobj, ".rela.bss"); s = bfd_get_linker_section (htab->dynobj, ".rela.bss");
BFD_ASSERT (s != NULL); BFD_ASSERT (s != NULL);
rela.r_offset = (h->root.u.def.value rela.r_offset = (h->root.u.def.value
@ -3078,7 +3064,7 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
} }
/* Mark some specially defined symbols as absolute. */ /* Mark some specially defined symbols as absolute. */
if (h == htab->root.hdynamic || h == htab->root.hgot) if (h == htab->hdynamic || h == htab->hgot)
sym->st_shndx = SHN_ABS; sym->st_shndx = SHN_ABS;
return TRUE; return TRUE;
@ -3091,7 +3077,7 @@ static bfd_boolean
m32r_elf_finish_dynamic_sections (bfd *output_bfd, m32r_elf_finish_dynamic_sections (bfd *output_bfd,
struct bfd_link_info *info) struct bfd_link_info *info)
{ {
struct elf_m32r_link_hash_table *htab; struct elf_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
asection *sdyn; asection *sdyn;
asection *sgot; asection *sgot;
@ -3104,12 +3090,12 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
if (htab == NULL) if (htab == NULL)
return FALSE; return FALSE;
dynobj = htab->root.dynobj; dynobj = htab->dynobj;
sgot = htab->root.sgotplt; sgot = htab->sgotplt;
sdyn = bfd_get_linker_section (dynobj, ".dynamic"); sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created) if (htab->dynamic_sections_created)
{ {
asection *splt; asection *splt;
Elf32_External_Dyn *dyncon, *dynconend; Elf32_External_Dyn *dyncon, *dynconend;
@ -3132,17 +3118,17 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
break; break;
case DT_PLTGOT: case DT_PLTGOT:
s = htab->root.sgotplt; s = htab->sgotplt;
goto get_vma; goto get_vma;
case DT_JMPREL: case DT_JMPREL:
s = htab->root.srelplt; s = htab->srelplt;
get_vma: get_vma:
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break; break;
case DT_PLTRELSZ: case DT_PLTRELSZ:
s = htab->root.srelplt; s = htab->srelplt;
dyn.d_un.d_val = s->size; dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break; break;
@ -3150,7 +3136,7 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
} }
/* Fill in the first entry in the procedure linkage table. */ /* Fill in the first entry in the procedure linkage table. */
splt = htab->root.splt; splt = htab->splt;
if (splt && splt->size > 0) if (splt && splt->size > 0)
{ {
if (bfd_link_pic (info)) if (bfd_link_pic (info))
@ -3369,7 +3355,7 @@ m32r_elf_check_relocs (bfd *abfd,
struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end; const Elf_Internal_Rela *rel_end;
struct elf_m32r_link_hash_table *htab; struct elf_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
asection *sreloc; asection *sreloc;
@ -3384,7 +3370,7 @@ m32r_elf_check_relocs (bfd *abfd,
if (htab == NULL) if (htab == NULL)
return FALSE; return FALSE;
dynobj = htab->root.dynobj; dynobj = htab->dynobj;
rel_end = relocs + sec->reloc_count; rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++) for (rel = relocs; rel < rel_end; rel++)
@ -3406,7 +3392,7 @@ m32r_elf_check_relocs (bfd *abfd,
} }
/* Some relocs require a global offset table. */ /* Some relocs require a global offset table. */
if (htab->root.sgot == NULL) if (htab->sgot == NULL)
{ {
switch (r_type) switch (r_type)
{ {
@ -3423,7 +3409,7 @@ m32r_elf_check_relocs (bfd *abfd,
case R_M32R_GOTPC_LO: case R_M32R_GOTPC_LO:
case R_M32R_GOT24: case R_M32R_GOT24:
if (dynobj == NULL) if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd; htab->dynobj = dynobj = abfd;
if (!_bfd_elf_create_got_section (dynobj, info)) if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE; return FALSE;
break; break;
@ -3540,7 +3526,7 @@ m32r_elf_check_relocs (bfd *abfd,
struct elf_dyn_relocs **head; struct elf_dyn_relocs **head;
if (dynobj == NULL) if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd; htab->dynobj = dynobj = abfd;
/* When creating a shared object, we must copy these /* When creating a shared object, we must copy these
relocs into the output file. We create a reloc relocs into the output file. We create a reloc

View File

@ -120,9 +120,6 @@ struct m68hc11_elf_link_hash_table
int top_index; int top_index;
asection **input_list; asection **input_list;
/* Small local sym cache. */
struct sym_cache sym_cache;
bfd_boolean (* size_one_stub) (struct bfd_hash_entry*, void*); bfd_boolean (* size_one_stub) (struct bfd_hash_entry*, void*);
bfd_boolean (* build_one_stub) (struct bfd_hash_entry*, void*); bfd_boolean (* build_one_stub) (struct bfd_hash_entry*, void*);
}; };

View File

@ -889,9 +889,6 @@ struct elf_m68k_link_hash_table
{ {
struct elf_link_hash_table root; struct elf_link_hash_table root;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* The PLT format used by this link, or NULL if the format has not /* The PLT format used by this link, or NULL if the format has not
yet been chosen. */ yet been chosen. */
const struct elf_m68k_plt_info *plt_info; const struct elf_m68k_plt_info *plt_info;
@ -2836,7 +2833,7 @@ elf_m68k_check_relocs (bfd *abfd,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&elf_m68k_hash_table (info)->sym_cache, isym = bfd_sym_from_r_symndx (&elf_m68k_hash_table (info)->root.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -823,9 +823,6 @@ struct elf_metag_link_hash_table
asection **input_list; asection **input_list;
Elf_Internal_Sym **all_local_syms; Elf_Internal_Sym **all_local_syms;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* Data for LDM relocations. */ /* Data for LDM relocations. */
union union
{ {
@ -2098,7 +2095,7 @@ elf_metag_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->etab.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -744,9 +744,6 @@ struct elf32_mb_link_hash_table
{ {
struct elf_link_hash_table elf; struct elf_link_hash_table elf;
/* Small local sym to section mapping cache. */
struct sym_cache sym_sec;
/* TLS Local Dynamic GOT Entry */ /* TLS Local Dynamic GOT Entry */
union { union {
bfd_signed_vma refcount; bfd_signed_vma refcount;
@ -2523,7 +2520,7 @@ microblaze_elf_check_relocs (bfd * abfd,
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
void *vpp; void *vpp;
isym = bfd_sym_from_r_symndx (&htab->sym_sec, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -3696,8 +3696,6 @@ nds32_elf_link_hash_table_create (bfd *abfd)
return NULL; return NULL;
} }
ret->sdynbss = NULL;
ret->srelbss = NULL;
ret->sym_ld_script = NULL; ret->sym_ld_script = NULL;
return &ret->root.root; return &ret->root.root;
@ -3833,7 +3831,7 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
initialize them at run time. The linker script puts the .dynbss initialize them at run time. The linker script puts the .dynbss
section into the .bss section of the final image. */ section into the .bss section of the final image. */
s = bfd_make_section (abfd, ".dynbss"); s = bfd_make_section (abfd, ".dynbss");
htab->sdynbss = s; htab->root.sdynbss = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_flags (s, SEC_ALLOC | SEC_LINKER_CREATED)) || !bfd_set_section_flags (s, SEC_ALLOC | SEC_LINKER_CREATED))
return FALSE; return FALSE;
@ -3852,7 +3850,7 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{ {
s = bfd_make_section (abfd, (bed->default_use_rela_p s = bfd_make_section (abfd, (bed->default_use_rela_p
? ".rela.bss" : ".rel.bss")); ? ".rela.bss" : ".rel.bss"));
htab->srelbss = s; htab->root.srelbss = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_flags (s, flags | SEC_READONLY) || !bfd_set_section_flags (s, flags | SEC_READONLY)
|| !bfd_set_section_alignment (s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
@ -3988,7 +3986,7 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
same memory location for the variable. */ same memory location for the variable. */
htab = nds32_elf_hash_table (info); htab = nds32_elf_hash_table (info);
s = htab->sdynbss; s = htab->root.sdynbss;
BFD_ASSERT (s != NULL); BFD_ASSERT (s != NULL);
/* We must generate a R_NDS32_COPY reloc to tell the dynamic linker /* We must generate a R_NDS32_COPY reloc to tell the dynamic linker
@ -3999,7 +3997,7 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
{ {
asection *srel; asection *srel;
srel = htab->srelbss; srel = htab->root.srelbss;
BFD_ASSERT (srel != NULL); BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf32_External_Rela); srel->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1; h->needs_copy = 1;
@ -7277,7 +7275,8 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx); isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -122,13 +122,6 @@ struct elf_nds32_link_hash_table
{ {
struct elf_link_hash_table root; struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Small local sym to section mapping cache. */
struct sym_cache sym_cache;
/* Target dependent options. */ /* Target dependent options. */
int relax_fp_as_gp; /* --mrelax-omit-fp. */ int relax_fp_as_gp; /* --mrelax-omit-fp. */
int eliminate_gc_relocs; /* --meliminate-gc-relocs. */ int eliminate_gc_relocs; /* --meliminate-gc-relocs. */

View File

@ -1808,9 +1808,6 @@ struct elf32_nios2_link_hash_table
bfd_vma offset; bfd_vma offset;
} tls_ldm_got; } tls_ldm_got;
/* Small local sym cache. */
struct sym_cache sym_cache;
bfd_vma res_n_size; bfd_vma res_n_size;
}; };
@ -4902,7 +4899,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -916,9 +916,6 @@ struct elf_or1k_link_hash_table
{ {
struct elf_link_hash_table root; struct elf_link_hash_table root;
/* Small local sym to section mapping cache. */
struct sym_cache sym_sec;
bfd_boolean saw_plta; bfd_boolean saw_plta;
}; };
@ -2151,7 +2148,7 @@ or1k_elf_check_relocs (bfd *abfd,
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
void *vpp; void *vpp;
isym = bfd_sym_from_r_symndx (&htab->sym_sec, isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -2212,9 +2212,6 @@ struct ppc_elf_link_hash_table
int plt_slot_size; int plt_slot_size;
/* The size of the first PLT entry. */ /* The size of the first PLT entry. */
int plt_initial_entry_size; int plt_initial_entry_size;
/* Small local sym cache. */
struct sym_cache sym_cache;
}; };
/* Rename some of the generic section flags to better document how they /* Rename some of the generic section flags to better document how they
@ -2952,7 +2949,7 @@ ppc_elf_check_relocs (bfd *abfd,
ifunc = NULL; ifunc = NULL;
if (h == NULL && htab->elf.target_os != is_vxworks) if (h == NULL && htab->elf.target_os != is_vxworks)
{ {
Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache, Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -3335,7 +3332,7 @@ ppc_elf_check_relocs (bfd *abfd,
asection *s; asection *s;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -3495,7 +3492,7 @@ ppc_elf_check_relocs (bfd *abfd,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -746,9 +746,6 @@ struct elf_s390_link_hash_table
bfd_signed_vma refcount; bfd_signed_vma refcount;
bfd_vma offset; bfd_vma offset;
} tls_ldm_got; } tls_ldm_got;
/* Small local sym cache. */
struct sym_cache sym_cache;
}; };
/* Get the s390 ELF linker hash table from a link_info structure. */ /* Get the s390 ELF linker hash table from a link_info structure. */
@ -930,7 +927,7 @@ elf_s390_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -1281,7 +1278,7 @@ elf_s390_check_relocs (bfd *abfd,
asection *s; asection *s;
void *vpp; void *vpp;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -3722,7 +3719,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
if (local_plt[i].plt.offset != (bfd_vma) -1) if (local_plt[i].plt.offset != (bfd_vma) -1)
{ {
asection *sec = local_plt[i].sec; asection *sec = local_plt[i].sec;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, i); isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, ibfd, i);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -2160,8 +2160,6 @@ struct elf_sh_link_hash_table
struct elf_link_hash_table root; struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */ /* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
asection *sfuncdesc; asection *sfuncdesc;
asection *srelfuncdesc; asection *srelfuncdesc;
asection *srofixup; asection *srofixup;
@ -2169,9 +2167,6 @@ struct elf_sh_link_hash_table
/* The (unloaded but important) VxWorks .rela.plt.unloaded section. */ /* The (unloaded but important) VxWorks .rela.plt.unloaded section. */
asection *srelplt2; asection *srelplt2;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* A counter or offset to track a TLS got entry. */ /* A counter or offset to track a TLS got entry. */
union union
{ {
@ -2439,7 +2434,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
section into the .bss section of the final image. */ section into the .bss section of the final image. */
s = bfd_make_section_anyway_with_flags (abfd, ".dynbss", s = bfd_make_section_anyway_with_flags (abfd, ".dynbss",
SEC_ALLOC | SEC_LINKER_CREATED); SEC_ALLOC | SEC_LINKER_CREATED);
htab->sdynbss = s; htab->root.sdynbss = s;
if (s == NULL) if (s == NULL)
return FALSE; return FALSE;
@ -2460,7 +2455,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
(bed->default_use_rela_p (bed->default_use_rela_p
? ".rela.bss" : ".rel.bss"), ? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY); flags | SEC_READONLY);
htab->srelbss = s; htab->root.srelbss = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
@ -2580,7 +2575,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
both the dynamic object and the regular object will refer to the both the dynamic object and the regular object will refer to the
same memory location for the variable. */ same memory location for the variable. */
s = htab->sdynbss; s = htab->root.sdynbss;
BFD_ASSERT (s != NULL); BFD_ASSERT (s != NULL);
/* We must generate a R_SH_COPY reloc to tell the dynamic linker to /* We must generate a R_SH_COPY reloc to tell the dynamic linker to
@ -2591,7 +2586,7 @@ sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
{ {
asection *srel; asection *srel;
srel = htab->srelbss; srel = htab->root.srelbss;
BFD_ASSERT (srel != NULL); BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf32_External_Rela); srel->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1; h->needs_copy = 1;
@ -3151,7 +3146,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|| s == htab->root.sgotplt || s == htab->root.sgotplt
|| s == htab->sfuncdesc || s == htab->sfuncdesc
|| s == htab->srofixup || s == htab->srofixup
|| s == htab->sdynbss) || s == htab->root.sdynbss)
{ {
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
@ -5679,7 +5674,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -46,9 +46,6 @@ struct elf32_tic6x_link_hash_table
/* C6X specific command line arguments. */ /* C6X specific command line arguments. */
struct elf32_tic6x_params params; struct elf32_tic6x_params params;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* The output BFD, for convenience. */ /* The output BFD, for convenience. */
bfd *obfd; bfd *obfd;
@ -2729,7 +2726,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -727,19 +727,11 @@ tilepro_elf_mkobject (bfd *abfd)
#include "elf/common.h" #include "elf/common.h"
#include "elf/internal.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. */ /* Get the Tilepro ELF linker hash table from a link_info structure. */
#define tilepro_elf_hash_table(p) \ #define tilepro_elf_hash_table(p) \
(elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \ (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
== TILEPRO_ELF_DATA \ == TILEPRO_ELF_DATA \
? ((struct tilepro_elf_link_hash_table *) ((p)->hash)) : NULL) ? ((struct elf_link_hash_table *) ((p)->hash)) : NULL)
static reloc_howto_type * static reloc_howto_type *
tilepro_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, 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 * static struct bfd_link_hash_table *
tilepro_elf_link_hash_table_create (bfd *abfd) tilepro_elf_link_hash_table_create (bfd *abfd)
{ {
struct tilepro_elf_link_hash_table *ret; struct elf_link_hash_table *ret;
size_t amt = sizeof (struct tilepro_elf_link_hash_table); 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) if (ret == NULL)
return 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), sizeof (struct tilepro_elf_link_hash_entry),
TILEPRO_ELF_DATA)) TILEPRO_ELF_DATA))
{ {
@ -1199,7 +1191,7 @@ tilepro_elf_link_hash_table_create (bfd *abfd)
return NULL; return NULL;
} }
return &ret->elf.root; return &ret->root;
} }
/* Create the .got section. */ /* Create the .got section. */
@ -1402,7 +1394,7 @@ static bfd_boolean
tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
asection *sec, const Elf_Internal_Rela *relocs) 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; Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel; 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); BFD_ASSERT (is_tilepro_elf (abfd) || num_relocs == 0);
if (htab->elf.dynobj == NULL) if (htab->dynobj == NULL)
htab->elf.dynobj = abfd; htab->dynobj = abfd;
rel_end = relocs + num_relocs; rel_end = relocs + num_relocs;
for (rel = relocs; rel < rel_end; rel++) 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; return FALSE;
} }
break; break;
@ -1716,7 +1708,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (sreloc == NULL) if (sreloc == NULL)
{ {
sreloc = _bfd_elf_make_dynamic_reloc_section 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) if (sreloc == NULL)
return FALSE; return FALSE;
@ -1754,7 +1746,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
{ {
size_t amt = sizeof *p; size_t amt = sizeof *p;
p = ((struct elf_dyn_relocs *) p = ((struct elf_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt)); bfd_alloc (htab->dynobj, amt));
if (p == NULL) if (p == NULL)
return FALSE; return FALSE;
p->next = *head; p->next = *head;
@ -1850,14 +1842,14 @@ static bfd_boolean
tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info, tilepro_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *h) struct elf_link_hash_entry *h)
{ {
struct tilepro_elf_link_hash_table *htab; struct elf_link_hash_table *htab;
asection *s, *srel; asection *s, *srel;
htab = tilepro_elf_hash_table (info); htab = tilepro_elf_hash_table (info);
BFD_ASSERT (htab != NULL); BFD_ASSERT (htab != NULL);
/* Make sure we know what is going on here. */ /* Make sure we know what is going on here. */
BFD_ASSERT (htab->elf.dynobj != NULL BFD_ASSERT (htab->dynobj != NULL
&& (h->needs_plt && (h->needs_plt
|| h->is_weakalias || h->is_weakalias
|| (h->def_dynamic || (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. */ .rel.bss section we are going to use. */
if ((h->root.u.def.section->flags & SEC_READONLY) != 0) if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
{ {
s = htab->elf.sdynrelro; s = htab->sdynrelro;
srel = htab->elf.sreldynrelro; srel = htab->sreldynrelro;
} }
else else
{ {
s = htab->elf.sdynbss; s = htab->sdynbss;
srel = htab->elf.srelbss; srel = htab->srelbss;
} }
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) 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) allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{ {
struct bfd_link_info *info; struct bfd_link_info *info;
struct tilepro_elf_link_hash_table *htab; struct elf_link_hash_table *htab;
struct elf_dyn_relocs *p; struct elf_dyn_relocs *p;
if (h->root.type == bfd_link_hash_indirect) 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); htab = tilepro_elf_hash_table (info);
BFD_ASSERT (htab != NULL); BFD_ASSERT (htab != NULL);
if (htab->elf.dynamic_sections_created if (htab->dynamic_sections_created
&& h->plt.refcount > 0) && h->plt.refcount > 0)
{ {
/* Make sure this symbol is output as a dynamic symbol. /* 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)) 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. */ /* Allocate room for the header. */
if (s->size == 0) if (s->size == 0)
@ -2021,10 +2013,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
s->size += PLT_ENTRY_SIZE; s->size += PLT_ENTRY_SIZE;
/* We also need to make an entry in the .got.plt section. */ /* 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. */ /* 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 else
{ {
@ -2060,22 +2052,22 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
return FALSE; return FALSE;
} }
s = htab->elf.sgot; s = htab->sgot;
h->got.offset = s->size; h->got.offset = s->size;
s->size += TILEPRO_BYTES_PER_WORD; s->size += TILEPRO_BYTES_PER_WORD;
/* R_TILEPRO_IMM16_Xn_TLS_GD entries need 2 consecutive GOT slots. */ /* R_TILEPRO_IMM16_Xn_TLS_GD entries need 2 consecutive GOT slots. */
if (tls_type == GOT_TLS_GD) if (tls_type == GOT_TLS_GD)
s->size += TILEPRO_BYTES_PER_WORD; 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_IE_xxx needs one dynamic relocation,
R_TILEPRO_IMM16_Xn_TLS_GD_xxx needs two if local symbol and two if R_TILEPRO_IMM16_Xn_TLS_GD_xxx needs two if local symbol and two if
global. */ global. */
if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE) 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, else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
bfd_link_pic (info), bfd_link_pic (info),
h)) h))
htab->elf.srelgot->size += TILEPRO_ELF_RELA_BYTES; htab->srelgot->size += TILEPRO_ELF_RELA_BYTES;
} }
else else
h->got.offset = (bfd_vma) -1; 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 if (!h->non_got_ref
&& ((h->def_dynamic && ((h->def_dynamic
&& !h->def_regular) && !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_undefweak
|| h->root.type == bfd_link_hash_undefined)))) || h->root.type == bfd_link_hash_undefined))))
{ {
@ -2195,14 +2187,14 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
{ {
(void)output_bfd; (void)output_bfd;
struct tilepro_elf_link_hash_table *htab; struct elf_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
asection *s; asection *s;
bfd *ibfd; bfd *ibfd;
htab = tilepro_elf_hash_table (info); htab = tilepro_elf_hash_table (info);
BFD_ASSERT (htab != NULL); BFD_ASSERT (htab != NULL);
dynobj = htab->elf.dynobj; dynobj = htab->dynobj;
BFD_ASSERT (dynobj != NULL); BFD_ASSERT (dynobj != NULL);
if (elf_hash_table (info)->dynamic_sections_created) 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; locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount; end_local_got = local_got + locsymcount;
local_tls_type = _bfd_tilepro_elf_local_got_tls_type (ibfd); local_tls_type = _bfd_tilepro_elf_local_got_tls_type (ibfd);
s = htab->elf.sgot; s = htab->sgot;
srel = htab->elf.srelgot; srel = htab->srelgot;
for (; local_got < end_local_got; ++local_got, ++local_tls_type) for (; local_got < end_local_got; ++local_got, ++local_tls_type)
{ {
if (*local_got > 0) 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 /* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */ 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 (elf_hash_table (info)->dynamic_sections_created)
{ {
/* If the .got section is more than 0x8000 bytes, we add /* If the .got section is more than 0x8000 bytes, we add
0x8000 to the value of _GLOBAL_OFFSET_TABLE_, so that 16 0x8000 to the value of _GLOBAL_OFFSET_TABLE_, so that 16
bit relocations have a greater chance of working. */ 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 == 0)
elf_hash_table (info)->hgot->root.u.def.value = 0x8000; elf_hash_table (info)->hgot->root.u.def.value = 0x8000;
} }
if (htab->elf.sgotplt) if (htab->sgotplt)
{ {
struct elf_link_hash_entry *got; struct elf_link_hash_entry *got;
got = elf_link_hash_lookup (elf_hash_table (info), 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_. */ entries and there is no refeence to _GLOBAL_OFFSET_TABLE_. */
if ((got == NULL if ((got == NULL
|| !got->ref_regular_nonweak) || !got->ref_regular_nonweak)
&& (htab->elf.sgotplt->size && (htab->sgotplt->size
== GOTPLT_HEADER_SIZE) == GOTPLT_HEADER_SIZE)
&& (htab->elf.splt == NULL && (htab->splt == NULL
|| htab->elf.splt->size == 0) || htab->splt->size == 0)
&& (htab->elf.sgot == NULL && (htab->sgot == NULL
|| (htab->elf.sgot->size || (htab->sgot->size
== get_elf_backend_data (output_bfd)->got_header_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 /* 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) if ((s->flags & SEC_LINKER_CREATED) == 0)
continue; continue;
if (s == htab->elf.splt if (s == htab->splt
|| s == htab->elf.sgot || s == htab->sgot
|| s == htab->elf.sgotplt || s == htab->sgotplt
|| s == htab->elf.sdynbss || s == htab->sdynbss
|| s == htab->elf.sdynrelro) || s == htab->sdynrelro)
{ {
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
@ -2527,7 +2519,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
Elf_Internal_Sym *local_syms, Elf_Internal_Sym *local_syms,
asection **local_sections) asection **local_sections)
{ {
struct tilepro_elf_link_hash_table *htab; struct elf_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **sym_hashes;
bfd_vma *local_got_offsets; 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: case R_TILEPRO_IMM16_X1_GOT_HA:
/* Relocation is to the entry for this symbol in the global /* Relocation is to the entry for this symbol in the global
offset table. */ offset table. */
if (htab->elf.sgot == NULL) if (htab->sgot == NULL)
abort (); abort ();
if (h != NULL) if (h != NULL)
@ -2792,7 +2784,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
else else
{ {
bfd_put_32 (output_bfd, relocation, bfd_put_32 (output_bfd, relocation,
htab->elf.sgot->contents + off); htab->sgot->contents + off);
h->got.offset |= 1; 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 /* We need to generate a R_TILEPRO_RELATIVE reloc
for the dynamic linker. */ for the dynamic linker. */
s = htab->elf.srelgot; s = htab->srelgot;
BFD_ASSERT (s != NULL); BFD_ASSERT (s != NULL);
outrel.r_offset = (htab->elf.sgot->output_section->vma outrel.r_offset = (htab->sgot->output_section->vma
+ htab->elf.sgot->output_offset + htab->sgot->output_offset
+ off); + off);
outrel.r_info = ELF32_R_INFO (0, R_TILEPRO_RELATIVE); outrel.r_info = ELF32_R_INFO (0, R_TILEPRO_RELATIVE);
outrel.r_addend = relocation; 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, bfd_put_32 (output_bfd, relocation,
htab->elf.sgot->contents + off); htab->sgot->contents + off);
local_got_offsets[r_symndx] |= 1; 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. */ procedure linkage table. */
BFD_ASSERT (h != NULL); 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 /* We didn't make a PLT entry for this symbol. This
happens when statically linking PIC code, or when 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; break;
} }
relocation = (htab->elf.splt->output_section->vma relocation = (htab->splt->output_section->vma
+ htab->elf.splt->output_offset + htab->splt->output_offset
+ h->plt.offset); + h->plt.offset);
unresolved_reloc = FALSE; unresolved_reloc = FALSE;
break; break;
@ -2993,7 +2985,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
outrel.r_addend = relocation + rel->r_addend; outrel.r_addend = relocation + rel->r_addend;
if (is_plt) if (is_plt)
sec = htab->elf.splt; sec = htab->splt;
if (bfd_is_abs_section (sec)) if (bfd_is_abs_section (sec))
indx = 0; indx = 0;
@ -3016,7 +3008,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (indx == 0) if (indx == 0)
{ {
osec = htab->elf.text_index_section; osec = htab->text_index_section;
indx = elf_section_data (osec)->dynindx; 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; local_got_offsets[r_symndx] |= 1;
} }
if (htab->elf.sgot == NULL) if (htab->sgot == NULL)
abort (); abort ();
if ((off & 1) != 0) if ((off & 1) != 0)
@ -3153,13 +3145,13 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
int indx = 0; int indx = 0;
bfd_boolean need_relocs = FALSE; bfd_boolean need_relocs = FALSE;
if (htab->elf.srelgot == NULL) if (htab->srelgot == NULL)
abort (); abort ();
if (h != NULL) if (h != NULL)
{ {
bfd_boolean dyn; bfd_boolean dyn;
dyn = htab->elf.dynamic_sections_created; dyn = htab->dynamic_sections_created;
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
bfd_link_pic (info), 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_X0_TLS_IE_HA:
case R_TILEPRO_IMM16_X1_TLS_IE_HA: case R_TILEPRO_IMM16_X1_TLS_IE_HA:
if (need_relocs) { if (need_relocs) {
bfd_put_32 (output_bfd, 0, htab->elf.sgot->contents + off); bfd_put_32 (output_bfd, 0, htab->sgot->contents + off);
outrel.r_offset = (htab->elf.sgot->output_section->vma outrel.r_offset = (htab->sgot->output_section->vma
+ htab->elf.sgot->output_offset + off); + htab->sgot->output_offset + off);
outrel.r_addend = 0; outrel.r_addend = 0;
if (indx == 0) if (indx == 0)
outrel.r_addend = relocation - dtpoff_base (info); outrel.r_addend = relocation - dtpoff_base (info);
outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_TPOFF32); 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); &outrel);
} else { } else {
bfd_put_32 (output_bfd, tpoff (info, relocation), bfd_put_32 (output_bfd, tpoff (info, relocation),
htab->elf.sgot->contents + off); htab->sgot->contents + off);
} }
break; 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_X0_TLS_GD_HA:
case R_TILEPRO_IMM16_X1_TLS_GD_HA: case R_TILEPRO_IMM16_X1_TLS_GD_HA:
if (need_relocs) { if (need_relocs) {
outrel.r_offset = (htab->elf.sgot->output_section->vma outrel.r_offset = (htab->sgot->output_section->vma
+ htab->elf.sgot->output_offset + off); + htab->sgot->output_offset + off);
outrel.r_addend = 0; outrel.r_addend = 0;
outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_DTPMOD32); outrel.r_info = ELF32_R_INFO (indx, R_TILEPRO_TLS_DTPMOD32);
bfd_put_32 (output_bfd, 0, htab->elf.sgot->contents + off); bfd_put_32 (output_bfd, 0, htab->sgot->contents + off);
tilepro_elf_append_rela_32 (output_bfd, htab->elf.srelgot, tilepro_elf_append_rela_32 (output_bfd, htab->srelgot,
&outrel); &outrel);
if (indx == 0) if (indx == 0)
{ {
BFD_ASSERT (! unresolved_reloc); BFD_ASSERT (! unresolved_reloc);
bfd_put_32 (output_bfd, bfd_put_32 (output_bfd,
relocation - dtpoff_base (info), relocation - dtpoff_base (info),
(htab->elf.sgot->contents + off + (htab->sgot->contents + off +
TILEPRO_BYTES_PER_WORD)); TILEPRO_BYTES_PER_WORD));
} }
else else
{ {
bfd_put_32 (output_bfd, 0, bfd_put_32 (output_bfd, 0,
(htab->elf.sgot->contents + off + (htab->sgot->contents + off +
TILEPRO_BYTES_PER_WORD)); TILEPRO_BYTES_PER_WORD));
outrel.r_info = ELF32_R_INFO (indx, outrel.r_info = ELF32_R_INFO (indx,
R_TILEPRO_TLS_DTPOFF32); R_TILEPRO_TLS_DTPOFF32);
outrel.r_offset += TILEPRO_BYTES_PER_WORD; outrel.r_offset += TILEPRO_BYTES_PER_WORD;
tilepro_elf_append_rela_32 (output_bfd, 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 symbol binding locally. Mark it as belonging
to module 1, the executable. */ to module 1, the executable. */
bfd_put_32 (output_bfd, 1, bfd_put_32 (output_bfd, 1,
htab->elf.sgot->contents + off ); htab->sgot->contents + off );
bfd_put_32 (output_bfd, relocation - dtpoff_base (info), bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
htab->elf.sgot->contents + off + htab->sgot->contents + off +
TILEPRO_BYTES_PER_WORD); TILEPRO_BYTES_PER_WORD);
} }
break; break;
@ -3411,7 +3403,7 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
struct elf_link_hash_entry *h, struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym) Elf_Internal_Sym *sym)
{ {
struct tilepro_elf_link_hash_table *htab; struct elf_link_hash_table *htab;
htab = tilepro_elf_hash_table (info); htab = tilepro_elf_hash_table (info);
BFD_ASSERT (htab != NULL); BFD_ASSERT (htab != NULL);
@ -3431,9 +3423,9 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
BFD_ASSERT (h->dynindx != -1); BFD_ASSERT (h->dynindx != -1);
splt = htab->elf.splt; splt = htab->splt;
srela = htab->elf.srelplt; srela = htab->srelplt;
sgotplt = htab->elf.sgotplt; sgotplt = htab->sgotplt;
if (splt == NULL || srela == NULL) if (splt == NULL || srela == NULL)
abort (); abort ();
@ -3481,8 +3473,8 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
/* This symbol has an entry in the GOT. Set it up. */ /* This symbol has an entry in the GOT. Set it up. */
sgot = htab->elf.sgot; sgot = htab->sgot;
srela = htab->elf.srelgot; srela = htab->srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL); BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma 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); + h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_TILEPRO_COPY); rela.r_info = ELF32_R_INFO (h->dynindx, R_TILEPRO_COPY);
rela.r_addend = 0; rela.r_addend = 0;
if (h->root.u.def.section == htab->elf.sdynrelro) if (h->root.u.def.section == htab->sdynrelro)
s = htab->elf.sreldynrelro; s = htab->sreldynrelro;
else else
s = htab->elf.srelbss; s = htab->srelbss;
tilepro_elf_append_rela_32 (output_bfd, s, &rela); tilepro_elf_append_rela_32 (output_bfd, s, &rela);
} }
/* Mark some specially defined symbols as absolute. */ /* Mark some specially defined symbols as absolute. */
if (h == htab->elf.hdynamic if (h == htab->hdynamic
|| (h == htab->elf.hgot || h == htab->elf.hplt)) || (h == htab->hgot || h == htab->hplt))
sym->st_shndx = SHN_ABS; sym->st_shndx = SHN_ABS;
return TRUE; return TRUE;
@ -3551,7 +3543,7 @@ tilepro_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
asection *splt ATTRIBUTE_UNUSED) asection *splt ATTRIBUTE_UNUSED)
{ {
Elf32_External_Dyn *dyncon, *dynconend; Elf32_External_Dyn *dyncon, *dynconend;
struct tilepro_elf_link_hash_table *htab; struct elf_link_hash_table *htab;
htab = tilepro_elf_hash_table (info); htab = tilepro_elf_hash_table (info);
BFD_ASSERT (htab != NULL); BFD_ASSERT (htab != NULL);
@ -3567,15 +3559,15 @@ tilepro_finish_dyn (bfd *output_bfd, struct bfd_link_info *info,
switch (dyn.d_tag) switch (dyn.d_tag)
{ {
case DT_PLTGOT: case DT_PLTGOT:
s = htab->elf.sgotplt; s = htab->sgotplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break; break;
case DT_JMPREL: case DT_JMPREL:
s = htab->elf.srelplt; s = htab->srelplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break; break;
case DT_PLTRELSZ: case DT_PLTRELSZ:
s = htab->elf.srelplt; s = htab->srelplt;
dyn.d_un.d_val = s->size; dyn.d_un.d_val = s->size;
break; break;
default: default:
@ -3593,11 +3585,11 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd,
{ {
bfd *dynobj; bfd *dynobj;
asection *sdyn; asection *sdyn;
struct tilepro_elf_link_hash_table *htab; struct elf_link_hash_table *htab;
htab = tilepro_elf_hash_table (info); htab = tilepro_elf_hash_table (info);
BFD_ASSERT (htab != NULL); BFD_ASSERT (htab != NULL);
dynobj = htab->elf.dynobj; dynobj = htab->dynobj;
sdyn = bfd_get_linker_section (dynobj, ".dynamic"); sdyn = bfd_get_linker_section (dynobj, ".dynamic");
@ -3606,7 +3598,7 @@ tilepro_elf_finish_dynamic_sections (bfd *output_bfd,
asection *splt; asection *splt;
bfd_boolean ret; bfd_boolean ret;
splt = htab->elf.splt; splt = htab->splt;
BFD_ASSERT (splt != NULL && sdyn != NULL); BFD_ASSERT (splt != NULL && sdyn != NULL);
ret = tilepro_finish_dyn (output_bfd, info, dynobj, sdyn, splt); 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; = 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 _bfd_error_handler
(_("discarded output section: `%pA'"), htab->elf.sgotplt); (_("discarded output section: `%pA'"), htab->sgotplt);
return FALSE; 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 /* Write the first two entries in .got.plt, needed for the dynamic
linker. */ linker. */
bfd_put_32 (output_bfd, (bfd_vma) -1, bfd_put_32 (output_bfd, (bfd_vma) -1,
htab->elf.sgotplt->contents); htab->sgotplt->contents);
bfd_put_32 (output_bfd, (bfd_vma) 0, 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; = 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 /* Set the first entry in the global offset table to the address of
the dynamic section. */ the dynamic section. */
bfd_vma val = (sdyn ? bfd_vma val = (sdyn ?
sdyn->output_section->vma + sdyn->output_offset : sdyn->output_section->vma + sdyn->output_offset :
0); 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; = GOT_ENTRY_SIZE;
} }

View File

@ -3250,9 +3250,6 @@ struct ppc_link_hash_table
/* Incremented every time we size stubs. */ /* Incremented every time we size stubs. */
unsigned int stub_iteration; unsigned int stub_iteration;
/* Small local sym cache. */
struct sym_cache sym_cache;
}; };
/* Rename some of the generic section flags to better document how they /* Rename some of the generic section flags to better document how they
@ -4383,7 +4380,8 @@ ppc64_elf_before_check_relocs (bfd *ibfd, struct bfd_link_info *info)
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
asection *s; asection *s;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, r_symndx); isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, ibfd,
r_symndx);
if (isym == NULL) if (isym == NULL)
{ {
if (elf_section_data (opd)->relocs != relocs) if (elf_section_data (opd)->relocs != relocs)
@ -4684,7 +4682,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
} }
else else
{ {
Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache, Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -4955,7 +4953,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
{ {
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -5231,7 +5229,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -663,9 +663,6 @@ struct elf_s390_link_hash_table
bfd_vma offset; bfd_vma offset;
} tls_ldm_got; } tls_ldm_got;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* Options passed from the linker. */ /* Options passed from the linker. */
struct s390_elf_params *params; struct s390_elf_params *params;
}; };
@ -852,7 +849,7 @@ elf_s390_check_relocs (bfd *abfd,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -1216,7 +1213,7 @@ elf_s390_check_relocs (bfd *abfd,
asection *s; asection *s;
void *vpp; void *vpp;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -2258,7 +2255,7 @@ elf_s390_relocate_section (bfd *output_bfd,
& 0xff00f000) == 0xe300c000 & 0xff00f000) == 0xe300c000
&& bfd_get_8 (input_bfd, && bfd_get_8 (input_bfd,
contents + rel->r_offset + 3) == 0x04)) contents + rel->r_offset + 3) == 0x04))
&& (isym = bfd_sym_from_r_symndx (&htab->sym_cache, && (isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
input_bfd, r_symndx)) input_bfd, r_symndx))
&& isym->st_shndx != SHN_ABS && isym->st_shndx != SHN_ABS
&& h != htab->elf.hdynamic && h != htab->elf.hdynamic
@ -3572,7 +3569,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
if (local_plt[i].plt.offset != (bfd_vma) -1) if (local_plt[i].plt.offset != (bfd_vma) -1)
{ {
asection *sec = local_plt[i].sec; asection *sec = local_plt[i].sec;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, ibfd, i); isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, ibfd, i);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -1371,7 +1371,7 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
{ {
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL); name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
} }
@ -1559,7 +1559,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
if (h == NULL) if (h == NULL)
{ {
Elf_Internal_Sym *isym Elf_Internal_Sym *isym
= bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx); = bfd_sym_from_r_symndx (&htab->elf.sym_cache, abfd, r_symndx);
/* Skip relocation against undefined symbols. */ /* Skip relocation against undefined symbols. */
if (isym->st_shndx == SHN_UNDEF) if (isym->st_shndx == SHN_UNDEF)
@ -1907,7 +1907,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
goto error_return; goto error_return;
@ -2308,7 +2308,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
asection *s; asection *s;
void **vpp; void **vpp;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
goto error_return; goto error_return;

View File

@ -2643,9 +2643,6 @@ struct elf_aarch64_link_hash_table
/* The bytes of the subsequent PLT entry. */ /* The bytes of the subsequent PLT entry. */
const bfd_byte *plt_entry; const bfd_byte *plt_entry;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* For convenience in allocate_dynrelocs. */ /* For convenience in allocate_dynrelocs. */
bfd *obfd; bfd *obfd;
@ -7610,7 +7607,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;
@ -7837,7 +7834,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
asection *s; asection *s;
void **vpp; void **vpp;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -113,9 +113,6 @@ struct riscv_elf_link_hash_table
/* Short-cuts to get to dynamic linker sections. */ /* Short-cuts to get to dynamic linker sections. */
asection *sdyntdata; asection *sdyntdata;
/* Small local sym to section mapping cache. */
struct sym_cache sym_cache;
/* The max alignment of output sections. */ /* The max alignment of output sections. */
bfd_vma max_alignment; bfd_vma max_alignment;
}; };
@ -681,7 +678,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -527,9 +527,6 @@ struct mips_elf_link_hash_table
returns null. */ returns null. */
asection *(*add_stub_section) (const char *, asection *, asection *); asection *(*add_stub_section) (const char *, asection *, asection *);
/* Small local sym cache. */
struct sym_cache sym_cache;
/* Is the PLT header compressed? */ /* Is the PLT header compressed? */
unsigned int plt_header_is_comp : 1; unsigned int plt_header_is_comp : 1;
}; };
@ -4401,7 +4398,7 @@ mips_elf_resolve_got_page_ref (void **refp, void *data)
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
/* Read in the symbol. */ /* Read in the symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, ref->u.abfd, isym = bfd_sym_from_r_symndx (&htab->root.sym_cache, ref->u.abfd,
ref->symndx); ref->symndx);
if (isym == NULL) if (isym == NULL)
{ {

View File

@ -1391,7 +1391,8 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (r_symndx < symtab_hdr->sh_info) if (r_symndx < symtab_hdr->sh_info)
{ {
/* A local symbol. */ /* A local symbol. */
isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx); isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, abfd,
r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -55,9 +55,6 @@ struct _bfd_sparc_elf_link_hash_table
bfd_vma offset; bfd_vma offset;
} tls_ldm_got; } tls_ldm_got;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* Used by local STT_GNU_IFUNC symbols. */ /* Used by local STT_GNU_IFUNC symbols. */
htab_t loc_hash_table; htab_t loc_hash_table;
void *loc_hash_memory; void *loc_hash_memory;

View File

@ -835,9 +835,6 @@ struct tilegx_elf_link_hash_table
/* Whether LE transition has been disabled for some of the /* Whether LE transition has been disabled for some of the
sections. */ sections. */
bfd_boolean disable_le_transition; bfd_boolean disable_le_transition;
/* Small local sym to section mapping cache. */
struct sym_cache sym_cache;
}; };
@ -1979,7 +1976,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
void *vpp; void *vpp;
Elf_Internal_Sym *isym; Elf_Internal_Sym *isym;
isym = bfd_sym_from_r_symndx (&htab->sym_cache, isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache,
abfd, r_symndx); abfd, r_symndx);
if (isym == NULL) if (isym == NULL)
return FALSE; return FALSE;

View File

@ -468,9 +468,6 @@ struct elf_x86_link_hash_table
/* The amount of space used by the jump slots in the GOT. */ /* The amount of space used by the jump slots in the GOT. */
bfd_vma sgotplt_jump_table_size; bfd_vma sgotplt_jump_table_size;
/* Small local sym cache. */
struct sym_cache sym_cache;
/* _TLS_MODULE_BASE_ symbol. */ /* _TLS_MODULE_BASE_ symbol. */
struct bfd_link_hash_entry *tls_module_base; struct bfd_link_hash_entry *tls_module_base;