Put .dynbss and .rel.bss shortcuts in main elf hash table

Also, create .rel{,a}.bss for PIEs on all targets, not just x86.

	* elf-bfd.h (struct elf_link_hash_table): Add sdynbss and srelbss.
	* elflink.c (_bfd_elf_create_dynamic_sections): Set them.  Create
	.rel.bss/.rela.bss for executables, both PIE and non-PIE.
	* elf32-arc.c (struct elf_arc_link_hash_table): Delete srelbss.
	Use ELF hash table var throughout.
	* elf32-arm.c (struct elf32_arm_link_hash_table): Delete sdynbss
	and srelbss.  Use ELF hash table vars throughout.
	* elf32-hppa.c (struct elf32_hppa_link_hash_table): Likewise.
	* elf32-i386.c (struct elf_i386_link_hash_table): Likewise.
	* elf32-metag.c (struct elf_metag_link_hash_table): Likewise.
	* elf32-microblaze.c (struct elf32_mb_link_hash_table): Likewise.
	* elf32-nios2.c (struct elf32_nios2_link_hash_table): Likewise.
	* elf32-or1k.c (struct elf_or1k_link_hash_table): Likewise.
	* elf32-ppc.c (struct ppc_elf_link_hash_table): Likewise.
	* elf32-s390.c (struct elf_s390_link_hash_table): Likewise.
	* elf32-tic6x.c (struct elf32_tic6x_link_hash_table): Likewise.
	* elf32-tilepro.c (struct tilepro_elf_link_hash_table): Likewise.
	* elf64-ppc.c (struct ppc_link_hash_table): Likewise.
	* elf64-s390.c (struct elf_s390_link_hash_table): Likewise.
	* elf64-x86-64.c (struct elf_x86_64_link_hash_table): Likewise.
	* elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Likewise.
	* elfnn-riscv.c (struct riscv_elf_link_hash_table): Likewise.
	* elfxx-mips.c (struct mips_elf_link_hash_table): Likewise.
	* elfxx-sparc.h (struct _bfd_sparc_elf_link_hash_table): Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-tilegx.c (struct tilegx_elf_link_hash_table): Likewise.

	* elf32-arc.c (arc_elf_create_dynamic_sections): Delete.
	(elf_backend_create_dynamic_sections): Use base ELF version.
	* elf32-microblaze.c (microblaze_elf_create_dynamic_sections): Delete.
	(elf_backend_create_dynamic_sections): Use base ELF version.
	* elf32-or1k.c (or1k_elf_create_dynamic_sections): Delete.
	(elf_backend_create_dynamic_sections): Use base ELF version.
	* elf32-s390.c (elf_s390_create_dynamic_sections): Delete.
	(elf_backend_create_dynamic_sections): Use base ELF version.
	* elf64-ppc.c (ppc64_elf_create_dynamic_sections): Delete.
	(elf_backend_create_dynamic_sections): Use base ELF version.
	* elf64-s390.c (elf_s390_create_dynamic_sections): Delete.
	(elf_backend_create_dynamic_sections): Use base ELF version.

	* elf32-tilepro.c (tilepro_elf_create_dynamic_sections): Remove
	extraneous tests.
	* elfnn-aarch64.c (elfNN_aarch64_create_dynamic_sections): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Likewise.
	* elfxx-tilegx.c (tilegx_elf_create_dynamic_sections): Likewise.

	* elf32-i386.c (elf_i386_create_dynamic_sections): Don't create
	".rel.bss" for executables.
	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't create
	".rela.bss" for executables.
	* elf32-nios2.c (nios2_elf32_create_dynamic_sections): Don't
	ignore return status from _bfd_elf_create_dynamic_sections.
This commit is contained in:
Alan Modra 2016-12-26 00:21:06 +10:30
parent 09a1b0e943
commit 9d19e4fdb7
24 changed files with 168 additions and 487 deletions

View File

@ -1,3 +1,58 @@
2016-12-26 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct elf_link_hash_table): Add sdynbss and srelbss.
* elflink.c (_bfd_elf_create_dynamic_sections): Set them. Create
.rel.bss/.rela.bss for executables, both PIE and non-PIE.
* elf32-arc.c (struct elf_arc_link_hash_table): Delete srelbss.
Use ELF hash table var throughout.
* elf32-arm.c (struct elf32_arm_link_hash_table): Delete sdynbss
and srelbss. Use ELF hash table vars throughout.
* elf32-hppa.c (struct elf32_hppa_link_hash_table): Likewise.
* elf32-i386.c (struct elf_i386_link_hash_table): Likewise.
* elf32-metag.c (struct elf_metag_link_hash_table): Likewise.
* elf32-microblaze.c (struct elf32_mb_link_hash_table): Likewise.
* elf32-nios2.c (struct elf32_nios2_link_hash_table): Likewise.
* elf32-or1k.c (struct elf_or1k_link_hash_table): Likewise.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Likewise.
* elf32-s390.c (struct elf_s390_link_hash_table): Likewise.
* elf32-tic6x.c (struct elf32_tic6x_link_hash_table): Likewise.
* elf32-tilepro.c (struct tilepro_elf_link_hash_table): Likewise.
* elf64-ppc.c (struct ppc_link_hash_table): Likewise.
* elf64-s390.c (struct elf_s390_link_hash_table): Likewise.
* elf64-x86-64.c (struct elf_x86_64_link_hash_table): Likewise.
* elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Likewise.
* elfnn-riscv.c (struct riscv_elf_link_hash_table): Likewise.
* elfxx-mips.c (struct mips_elf_link_hash_table): Likewise.
* elfxx-sparc.h (struct _bfd_sparc_elf_link_hash_table): Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c (struct tilegx_elf_link_hash_table): Likewise.
* elf32-arc.c (arc_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-microblaze.c (microblaze_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-or1k.c (or1k_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-s390.c (elf_s390_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf64-ppc.c (ppc64_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf64-s390.c (elf_s390_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-tilepro.c (tilepro_elf_create_dynamic_sections): Remove
extraneous tests.
* elfnn-aarch64.c (elfNN_aarch64_create_dynamic_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Likewise.
* elfxx-tilegx.c (tilegx_elf_create_dynamic_sections): Likewise.
* elf32-i386.c (elf_i386_create_dynamic_sections): Don't create
".rel.bss" for executables.
* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't create
".rela.bss" for executables.
* elf32-nios2.c (nios2_elf32_create_dynamic_sections): Don't
ignore return status from _bfd_elf_create_dynamic_sections.
2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
* bfd/elfxx-mips.c (_bfd_mips_post_process_headers): Revert

View File

@ -595,6 +595,8 @@ struct elf_link_hash_table
asection *srelgot;
asection *splt;
asection *srelplt;
asection *sdynbss;
asection *srelbss;
asection *igotplt;
asection *iplt;
asection *irelplt;

View File

@ -314,9 +314,6 @@ struct elf_arc_link_hash_entry
struct elf_arc_link_hash_table
{
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *srelbss;
};
static struct bfd_hash_entry *
@ -375,8 +372,6 @@ arc_elf_link_hash_table_create (bfd *abfd)
return NULL;
}
ret->srelbss = NULL;
ret->elf.init_got_refcount.refcount = 0;
ret->elf.init_got_refcount.glist = NULL;
ret->elf.init_got_offset.offset = 0;
@ -1567,45 +1562,6 @@ elf_arc_relocate_section (bfd * output_bfd,
(elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
== ARC_ELF_DATA ? ((struct elf_arc_link_hash_table *) ((p)->hash)) : NULL)
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
.rela.bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
static bfd_boolean
arc_elf_create_dynamic_sections (bfd *dynobj,
struct bfd_link_info *info)
{
struct elf_arc_link_hash_table *htab;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab = elf_arc_hash_table (info);
if (htab == NULL)
return FALSE;
if (bfd_link_executable (info))
{
/* Always allow copy relocs for building executables. */
asection *s = bfd_get_linker_section (dynobj, ".rela.bss");
if (s == NULL)
{
const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
s = bfd_make_section_anyway_with_flags (dynobj,
".rela.bss",
(bed->dynamic_sec_flags
| SEC_READONLY));
if (s == NULL
|| ! bfd_set_section_alignment (dynobj, s,
bed->s->log_file_align))
return FALSE;
}
htab->srelbss = s;
}
return TRUE;
}
static struct dynamic_sections
arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
{
@ -2105,8 +2061,8 @@ elf_arc_adjust_dynamic_symbol (struct bfd_link_info *info,
{
struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
BFD_ASSERT (arc_htab->srelbss != NULL);
arc_htab->srelbss->size += sizeof (Elf32_External_Rela);
BFD_ASSERT (arc_htab->elf.srelbss != NULL);
arc_htab->elf.srelbss->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
}
@ -2161,16 +2117,16 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| arc_htab->srelbss == NULL)
|| arc_htab->elf.srelbss == NULL)
abort ();
bfd_vma rel_offset = (h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
bfd_byte * loc = arc_htab->srelbss->contents
+ (arc_htab->srelbss->reloc_count * sizeof (Elf32_External_Rela));
arc_htab->srelbss->reloc_count++;
bfd_byte * loc = arc_htab->elf.srelbss->contents
+ (arc_htab->elf.srelbss->reloc_count * sizeof (Elf32_External_Rela));
arc_htab->elf.srelbss->reloc_count++;
Elf_Internal_Rela rel;
rel.r_addend = 0;
@ -2604,7 +2560,7 @@ elf32_arc_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
#define elf_backend_relocate_section elf_arc_relocate_section
#define elf_backend_check_relocs elf_arc_check_relocs
#define elf_backend_create_dynamic_sections arc_elf_create_dynamic_sections
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_reloc_type_class elf32_arc_reloc_type_class

View File

@ -3158,10 +3158,6 @@ struct elf32_arm_link_hash_table
/* How many R_ARM_TLS_DESC relocations were generated so far. */
bfd_vma num_tls_desc;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* The (unloaded but important) VxWorks .rela.plt.unloaded section. */
asection *srelplt2;
@ -3648,11 +3644,6 @@ elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj,
RELOC_SECTION (htab, ".bss"));
if (htab->vxworks_p)
{
if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
@ -3694,8 +3685,8 @@ elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
if (!htab->root.splt
|| !htab->root.srelplt
|| !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
|| !htab->root.sdynbss
|| (!bfd_link_pic (info) && !htab->root.srelbss))
abort ();
return TRUE;
@ -15372,7 +15363,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
determine the address it must put in the global offset table, so
both the dynamic object and the regular object will refer to the
same memory location for the variable. */
s = bfd_get_linker_section (dynobj, ".dynbss");
s = globals->root.sdynbss;
BFD_ASSERT (s != NULL);
/* If allowed, we must generate a R_ARM_COPY reloc to tell the dynamic
@ -16100,7 +16091,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
&& s != htab->root.sgotplt
&& s != htab->root.iplt
&& s != htab->root.igotplt
&& s != htab->sdynbss)
&& s != htab->root.sdynbss)
{
/* It's not one of our sections, so don't allocate space. */
continue;
@ -16310,7 +16301,7 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd,
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak));
s = htab->srelbss;
s = htab->root.srelbss;
BFD_ASSERT (s != NULL);
rel.r_addend = 0;

View File

@ -274,10 +274,6 @@ struct elf32_hppa_link_hash_table
asection **input_list;
Elf_Internal_Sym **all_local_syms;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Used during a final link to store the base of the text and data
segments so that we can perform SEGREL relocations. */
bfd_vma text_segment_base;
@ -998,9 +994,6 @@ elf32_hppa_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (! _bfd_elf_create_dynamic_sections (abfd, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
/* hppa-linux needs _GLOBAL_OFFSET_TABLE_ to be visible from the main
application, because __canonicalize_funcptr_for_compare needs it. */
eh = elf_hash_table (info)->hgot;
@ -1908,11 +1901,11 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
runtime process image. */
if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0 && eh->size != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rela);
htab->etab.srelbss->size += sizeof (Elf32_External_Rela);
eh->needs_copy = 1;
}
sec = htab->sdynbss;
sec = htab->etab.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, eh, sec);
}
@ -2381,7 +2374,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
}
}
else if (sec == htab->etab.sgot
|| sec == htab->sdynbss)
|| sec == htab->etab.sdynbss)
;
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, sec), ".rela"))
{
@ -4434,7 +4427,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
|| eh->root.type == bfd_link_hash_defweak)))
abort ();
sec = htab->srelbss;
sec = htab->etab.srelbss;
rela.r_offset = (eh->root.u.def.value
+ eh->root.u.def.section->output_offset

View File

@ -848,8 +848,6 @@ struct elf_i386_link_hash_table
/* Short-cuts to get to dynamic linker sections. */
asection *interp;
asection *sdynbss;
asection *srelbss;
asection *plt_eh_frame;
asection *plt_got;
@ -1084,29 +1082,6 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
htab->interp = s;
}
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!htab->sdynbss)
abort ();
if (bfd_link_executable (info))
{
/* Always allow copy relocs for building executables. */
asection *s = bfd_get_linker_section (dynobj, ".rel.bss");
if (s == NULL)
{
const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
s = bfd_make_section_anyway_with_flags (dynobj,
".rel.bss",
(bed->dynamic_sec_flags
| SEC_READONLY));
if (s == NULL
|| ! bfd_set_section_alignment (dynobj, s,
bed->s->log_file_align))
return FALSE;
}
htab->srelbss = s;
}
if (get_elf_i386_backend_data (dynobj)->is_vxworks
&& !elf_vxworks_create_dynamic_sections (dynobj, info,
&htab->srelplt2))
@ -2611,11 +2586,11 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rel);
htab->elf.srelbss->size += sizeof (Elf32_External_Rel);
h->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->elf.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
}
@ -3430,7 +3405,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|| s == htab->elf.igotplt
|| s == htab->plt_got
|| s == htab->plt_eh_frame
|| s == htab->sdynbss)
|| s == htab->elf.sdynbss)
{
/* Strip these too. */
}
@ -5595,14 +5570,14 @@ do_glob_dat:
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->srelbss == NULL)
|| htab->elf.srelbss == NULL)
abort ();
rel.r_offset = (h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY);
elf_append_rel (output_bfd, htab->srelbss, &rel);
elf_append_rel (output_bfd, htab->elf.srelbss, &rel);
}
return TRUE;

View File

@ -842,10 +842,6 @@ struct elf_metag_link_hash_table
asection **input_list;
Elf_Internal_Sym **all_local_syms;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Small local sym cache. */
struct sym_cache sym_cache;
@ -2069,9 +2065,6 @@ elf_metag_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
htab->etab.hgot = eh;
htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
return TRUE;
}
@ -2573,11 +2566,11 @@ elf_metag_adjust_dynamic_symbol (struct bfd_link_info *info,
runtime process image. */
if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0 && eh->size != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rela);
htab->etab.srelbss->size += sizeof (Elf32_External_Rela);
eh->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->etab.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, eh, s);
}
@ -2940,7 +2933,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (s == htab->etab.splt
|| s == htab->etab.sgot
|| s == htab->etab.sgotplt
|| s == htab->sdynbss)
|| s == htab->etab.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -3222,7 +3215,7 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd,
|| eh->root.type == bfd_link_hash_defweak)))
abort ();
s = htab->srelbss;
s = htab->etab.srelbss;
rel.r_offset = (eh->root.u.def.value
+ eh->root.u.def.section->output_offset

View File

@ -730,10 +730,6 @@ struct elf32_mb_link_hash_table
{
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Small local sym to section mapping cache. */
struct sym_cache sym_sec;
@ -2503,32 +2499,6 @@ microblaze_elf_check_relocs (bfd * abfd,
return TRUE;
}
static bfd_boolean
microblaze_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct elf32_mb_link_hash_table *htab;
htab = elf32_mb_hash_table (info);
if (htab == NULL)
return FALSE;
if (!htab->elf.sgot && !_bfd_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
@ -2692,7 +2662,7 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
BFD_ASSERT (dynobj != NULL);
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rela);
htab->elf.srelbss->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
}
@ -2702,7 +2672,7 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
if (power_of_two > 3)
power_of_two = 3;
sdynbss = htab->sdynbss;
sdynbss = htab->elf.sdynbss;
/* Apply the required alignment. */
sdynbss->size = BFD_ALIGN (sdynbss->size, (bfd_size_type) (1 << power_of_two));
if (power_of_two > bfd_get_section_alignment (dynobj, sdynbss))
@ -3473,7 +3443,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
#define elf_backend_dtrel_excludes_plt 1
#define elf_backend_adjust_dynamic_symbol microblaze_elf_adjust_dynamic_symbol
#define elf_backend_create_dynamic_sections microblaze_elf_create_dynamic_sections
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol
#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections

View File

@ -1820,8 +1820,6 @@ struct elf32_nios2_link_hash_table
Elf_Internal_Sym **all_local_syms;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
asection *sbss;
/* GOT pointer symbol _gp_got. */
@ -4602,26 +4600,14 @@ nios2_elf32_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
if (!htab->root.sgot && !create_got_section (dynobj, info))
return FALSE;
_bfd_elf_create_dynamic_sections (dynobj, info);
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
/* In order for the two loads in a shared object .PLTresolve to share the
same %hiadj, the start of the PLT (as well as the GOT) must be aligned
to a 16-byte boundary. This is because the addresses for these loads
include the -(.plt+4) PIC correction. */
if (!bfd_set_section_alignment (dynobj, htab->root.splt, 4))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!htab->sdynbss)
return FALSE;
if (!bfd_link_pic (info))
{
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->srelbss)
return FALSE;
}
return TRUE;
return bfd_set_section_alignment (dynobj, htab->root.splt, 4);
}
/* Implement elf_backend_copy_indirect_symbol:
@ -5289,7 +5275,7 @@ nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak));
s = htab->srelbss;
s = htab->root.srelbss;
BFD_ASSERT (s != NULL);
rela.r_offset = (h->root.u.def.value
@ -5537,7 +5523,7 @@ nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info,
determine the address it must put in the global offset table, so
both the dynamic object and the regular object will refer to the
same memory location for the variable. */
s = htab->sdynbss;
s = htab->root.sdynbss;
BFD_ASSERT (s != NULL);
/* We must generate a R_NIOS2_COPY reloc to tell the dynamic linker to
@ -5548,7 +5534,7 @@ nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info,
{
asection *srel;
srel = htab->srelbss;
srel = htab->root.srelbss;
BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;

View File

@ -615,10 +615,6 @@ struct elf_or1k_link_hash_table
{
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_sec;
};
@ -2102,7 +2098,7 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
if (htab == NULL)
return FALSE;
s = htab->sdynbss;
s = htab->root.sdynbss;
BFD_ASSERT (s != NULL);
/* We must generate a R_OR1K_COPY reloc to tell the dynamic linker
@ -2113,7 +2109,7 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
{
asection *srel;
srel = htab->srelbss;
srel = htab->root.srelbss;
BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
@ -2476,7 +2472,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (s == htab->root.splt
|| s == htab->root.sgot
|| s == htab->root.sgotplt
|| s == htab->sdynbss)
|| s == htab->root.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -2574,34 +2570,6 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
return TRUE;
}
/* Create dynamic sections when linking against a dynamic object. */
static bfd_boolean
or1k_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct elf_or1k_link_hash_table *htab;
htab = or1k_elf_hash_table (info);
if (htab == NULL)
return FALSE;
if (!htab->root.sgot && !_bfd_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
if (!htab->root.splt || !htab->root.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
@ -2777,7 +2745,7 @@ elf32_or1k_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
#define bfd_elf32_bfd_link_hash_table_create or1k_elf_link_hash_table_create
#define elf_backend_copy_indirect_symbol or1k_elf_copy_indirect_symbol
#define elf_backend_create_dynamic_sections or1k_elf_create_dynamic_sections
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_finish_dynamic_sections or1k_elf_finish_dynamic_sections
#define elf_backend_size_dynamic_sections or1k_elf_size_dynamic_sections
#define elf_backend_adjust_dynamic_symbol or1k_elf_adjust_dynamic_symbol

View File

@ -3276,8 +3276,6 @@ struct ppc_elf_link_hash_table
/* Short-cuts to get to dynamic linker sections. */
asection *glink;
asection *dynbss;
asection *relbss;
asection *dynsbss;
asection *relsbss;
elf_linker_section_t sdata[2];
@ -3556,7 +3554,6 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
&& !ppc_elf_create_glink (abfd, info))
return FALSE;
htab->dynbss = bfd_get_linker_section (abfd, ".dynbss");
s = bfd_make_section_anyway_with_flags (abfd, ".dynsbss",
SEC_ALLOC | SEC_LINKER_CREATED);
htab->dynsbss = s;
@ -3565,7 +3562,6 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (! bfd_link_pic (info))
{
htab->relbss = bfd_get_linker_section (abfd, ".rela.bss");
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
s = bfd_make_section_anyway_with_flags (abfd, ".rela.sbss", flags);
@ -5811,7 +5807,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
if (ppc_elf_hash_entry (h)->has_sda_refs)
s = htab->dynsbss;
else
s = htab->dynbss;
s = htab->elf.sdynbss;
BFD_ASSERT (s != NULL);
/* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
@ -5825,7 +5821,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
if (ppc_elf_hash_entry (h)->has_sda_refs)
srel = htab->relsbss;
else
srel = htab->relbss;
srel = htab->elf.srelbss;
BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
@ -6639,7 +6635,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|| s == htab->glink_eh_frame
|| s == htab->elf.sgotplt
|| s == htab->sbss
|| s == htab->dynbss
|| s == htab->elf.sdynbss
|| s == htab->dynsbss)
{
/* Strip these too. */
@ -10361,7 +10357,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
if (ppc_elf_hash_entry (h)->has_sda_refs)
s = htab->relsbss;
else
s = htab->relbss;
s = htab->elf.srelbss;
BFD_ASSERT (s != NULL);
rela.r_offset = SYM_VAL (h);

View File

@ -738,8 +738,6 @@ struct elf_s390_link_hash_table
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
asection *irelifunc;
union
@ -818,33 +816,6 @@ elf_s390_link_hash_table_create (bfd *abfd)
return &ret->elf.root;
}
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
.rela.bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
static bfd_boolean
elf_s390_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
htab = elf_s390_hash_table (info);
if (!htab->elf.sgot && !_bfd_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
@ -1788,11 +1759,11 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rela);
htab->elf.srelbss->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->elf.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
}
@ -2185,7 +2156,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (s == htab->elf.splt
|| s == htab->elf.sgot
|| s == htab->elf.sgotplt
|| s == htab->sdynbss
|| s == htab->elf.sdynbss
|| s == htab->elf.iplt
|| s == htab->elf.igotplt
|| s == htab->irelifunc)
@ -3836,7 +3807,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->srelbss == NULL)
|| htab->elf.srelbss == NULL)
abort ();
rela.r_offset = (h->root.u.def.value
@ -3844,8 +3815,8 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
loc = htab->srelbss->contents;
loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rela);
loc = htab->elf.srelbss->contents;
loc += htab->elf.srelbss->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
@ -4197,7 +4168,7 @@ elf32_s390_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs
#define elf_backend_copy_indirect_symbol elf_s390_copy_indirect_symbol
#define elf_backend_create_dynamic_sections elf_s390_create_dynamic_sections
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_finish_dynamic_sections elf_s390_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf_s390_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook

View File

@ -43,10 +43,6 @@ struct elf32_tic6x_link_hash_table
{
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* C6X specific command line arguments. */
struct elf32_tic6x_params params;
@ -1660,14 +1656,6 @@ elf32_tic6x_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|| ! bfd_set_section_alignment (dynobj, htab->elf.splt, 5))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
}
@ -1878,7 +1866,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd,
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->srelbss == NULL)
|| htab->elf.srelbss == NULL)
abort ();
rel.r_offset = (h->root.u.def.value
@ -1887,7 +1875,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd,
rel.r_info = ELF32_R_INFO (h->dynindx, R_C6000_COPY);
rel.r_addend = 0;
elf32_tic6x_install_rela (output_bfd, htab->srelbss, &rel);
elf32_tic6x_install_rela (output_bfd, htab->elf.srelbss, &rel);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
@ -2160,11 +2148,11 @@ elf32_tic6x_adjust_dynamic_symbol (struct bfd_link_info *info,
runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rela);
htab->elf.srelbss->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->elf.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
}
@ -3388,7 +3376,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
else if (s == htab->elf.splt
|| s == htab->elf.sgot
|| s == htab->elf.sgotplt
|| s == htab->sdynbss)
|| s == htab->elf.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */

View File

@ -754,10 +754,6 @@ struct tilepro_elf_link_hash_table
{
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Small local sym to section mapping cache. */
struct sym_cache sym_cache;
};
@ -1295,26 +1291,10 @@ static bfd_boolean
tilepro_elf_create_dynamic_sections (bfd *dynobj,
struct bfd_link_info *info)
{
struct tilepro_elf_link_hash_table *htab;
htab = tilepro_elf_hash_table (info);
BFD_ASSERT (htab != NULL);
if (!tilepro_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
return _bfd_elf_create_dynamic_sections (dynobj, info);
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
@ -2186,11 +2166,11 @@ 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_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += TILEPRO_ELF_RELA_BYTES;
htab->elf.srelbss->size += TILEPRO_ELF_RELA_BYTES;
h->needs_copy = 1;
}
return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss);
return _bfd_elf_adjust_dynamic_copy (info, h, htab->elf.sdynbss);
}
/* Allocate space in .plt, .got and associated reloc sections for
@ -2585,7 +2565,7 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
if (s == htab->elf.splt
|| s == htab->elf.sgot
|| s == htab->elf.sgotplt
|| s == htab->sdynbss)
|| s == htab->elf.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -3817,7 +3797,7 @@ tilepro_elf_finish_dynamic_symbol (bfd *output_bfd,
/* This symbols needs a copy reloc. Set it up. */
BFD_ASSERT (h->dynindx != -1);
s = htab->srelbss;
s = htab->elf.srelbss;
BFD_ASSERT (s != NULL);
rela.r_offset = (h->root.u.def.value

View File

@ -93,7 +93,7 @@ static bfd_vma opd_entry_value
#define elf_backend_grok_prstatus ppc64_elf_grok_prstatus
#define elf_backend_grok_psinfo ppc64_elf_grok_psinfo
#define elf_backend_write_core_note ppc64_elf_write_core_note
#define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol
#define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook
#define elf_backend_check_directives ppc64_elf_before_check_relocs
@ -4053,8 +4053,6 @@ struct ppc_link_hash_table
struct ppc_link_hash_entry *dot_syms;
/* Shortcuts to get to dynamic linker sections. */
asection *dynbss;
asection *relbss;
asection *glink;
asection *sfpr;
asection *brlt;
@ -4638,31 +4636,6 @@ create_got_section (bfd *abfd, struct bfd_link_info *info)
return TRUE;
}
/* Create the dynamic sections, and set up shortcuts. */
static bfd_boolean
ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
{
struct ppc_link_hash_table *htab;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab = ppc_hash_table (info);
if (htab == NULL)
return FALSE;
htab->dynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->relbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->elf.sgot || !htab->elf.splt || !htab->elf.srelplt || !htab->dynbss
|| (!bfd_link_pic (info) && !htab->relbss))
abort ();
return TRUE;
}
/* Follow indirect and warning symbol links. */
static inline struct bfd_link_hash_entry *
@ -7394,11 +7367,11 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
.rela.bss section we are going to use. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
htab->relbss->size += sizeof (Elf64_External_Rela);
htab->elf.srelbss->size += sizeof (Elf64_External_Rela);
h->needs_copy = 1;
}
s = htab->dynbss;
s = htab->elf.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
}
@ -10201,7 +10174,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
|| s == htab->elf.splt
|| s == htab->elf.iplt
|| s == htab->glink
|| s == htab->dynbss)
|| s == htab->elf.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -15452,7 +15425,7 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->relbss == NULL)
|| htab->elf.srelbss == NULL)
abort ();
rela.r_offset = (h->root.u.def.value
@ -15460,8 +15433,8 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY);
rela.r_addend = 0;
loc = htab->relbss->contents;
loc += htab->relbss->reloc_count++ * sizeof (Elf64_External_Rela);
loc = htab->elf.srelbss->contents;
loc += htab->elf.srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}

View File

@ -651,8 +651,6 @@ struct elf_s390_link_hash_table
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
asection *irelifunc;
union {
@ -730,37 +728,6 @@ elf_s390_link_hash_table_create (bfd *abfd)
return &ret->elf.root;
}
/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
.rela.bss sections in DYNOBJ, and set up shortcuts to them in our
hash table. */
static bfd_boolean
elf_s390_create_dynamic_sections (bfd *dynobj,
struct bfd_link_info *info)
{
struct elf_s390_link_hash_table *htab;
htab = elf_s390_hash_table (info);
if (htab == NULL)
return FALSE;
if (!htab->elf.sgot && !_bfd_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
@ -1728,11 +1695,11 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info,
runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += sizeof (Elf64_External_Rela);
htab->elf.srelbss->size += sizeof (Elf64_External_Rela);
h->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->elf.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
}
@ -2131,7 +2098,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (s == htab->elf.splt
|| s == htab->elf.sgot
|| s == htab->elf.sgotplt
|| s == htab->sdynbss
|| s == htab->elf.sdynbss
|| s == htab->elf.iplt
|| s == htab->elf.igotplt
|| s == htab->irelifunc)
@ -3625,7 +3592,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->srelbss == NULL)
|| htab->elf.srelbss == NULL)
abort ();
rela.r_offset = (h->root.u.def.value
@ -3633,8 +3600,8 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
loc = htab->srelbss->contents;
loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
loc = htab->elf.srelbss->contents;
loc += htab->elf.srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
@ -4025,7 +3992,7 @@ const struct elf_size_info s390_elf64_size_info =
#define elf_backend_adjust_dynamic_symbol elf_s390_adjust_dynamic_symbol
#define elf_backend_check_relocs elf_s390_check_relocs
#define elf_backend_copy_indirect_symbol elf_s390_copy_indirect_symbol
#define elf_backend_create_dynamic_sections elf_s390_create_dynamic_sections
#define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections
#define elf_backend_finish_dynamic_sections elf_s390_finish_dynamic_sections
#define elf_backend_finish_dynamic_symbol elf_s390_finish_dynamic_symbol
#define elf_backend_gc_mark_hook elf_s390_gc_mark_hook

View File

@ -862,8 +862,6 @@ struct elf_x86_64_link_hash_table
/* Short-cuts to get to dynamic linker sections. */
asection *interp;
asection *sdynbss;
asection *srelbss;
asection *plt_eh_frame;
asection *plt_bnd;
asection *plt_got;
@ -1127,29 +1125,6 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj,
htab->interp = s;
}
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!htab->sdynbss)
abort ();
if (bfd_link_executable (info))
{
/* Always allow copy relocs for building executables. */
asection *s = bfd_get_linker_section (dynobj, ".rela.bss");
if (s == NULL)
{
const struct elf_backend_data *bed = get_elf_backend_data (dynobj);
s = bfd_make_section_anyway_with_flags (dynobj,
".rela.bss",
(bed->dynamic_sec_flags
| SEC_READONLY));
if (s == NULL
|| ! bfd_set_section_alignment (dynobj, s,
bed->s->log_file_align))
return FALSE;
}
htab->srelbss = s;
}
if (!info->no_ld_generated_unwind_info
&& htab->plt_eh_frame == NULL
&& htab->elf.splt != NULL)
@ -3015,11 +2990,11 @@ elf_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
{
const struct elf_backend_data *bed;
bed = get_elf_backend_data (info->output_bfd);
htab->srelbss->size += bed->s->sizeof_rela;
htab->elf.srelbss->size += bed->s->sizeof_rela;
h->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->elf.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
}
@ -3836,7 +3811,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
|| s == htab->plt_bnd
|| s == htab->plt_got
|| s == htab->plt_eh_frame
|| s == htab->sdynbss)
|| s == htab->elf.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -6055,7 +6030,7 @@ do_glob_dat:
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->srelbss == NULL)
|| htab->elf.srelbss == NULL)
abort ();
rela.r_offset = (h->root.u.def.value
@ -6063,7 +6038,7 @@ do_glob_dat:
+ h->root.u.def.section->output_offset);
rela.r_info = htab->r_info (h->dynindx, R_X86_64_COPY);
rela.r_addend = 0;
elf_append_rela (output_bfd, htab->srelbss, &rela);
elf_append_rela (output_bfd, htab->elf.srelbss, &rela);
}
return TRUE;

View File

@ -427,6 +427,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
(SEC_ALLOC | SEC_LINKER_CREATED));
if (s == NULL)
return FALSE;
htab->sdynbss = s;
/* The .rel[a].bss section holds copy relocs. This section is not
normally needed. We need to create it here, though, so that the
@ -439,7 +440,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
be needed, we can discard it later. We will never need this
section when generating a shared object, since they do not use
copy relocs. */
if (! bfd_link_pic (info))
if (bfd_link_executable (info))
{
s = bfd_make_section_anyway_with_flags (abfd,
(bed->rela_plts_and_copies_p
@ -448,6 +449,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
htab->srelbss = s;
}
}

View File

@ -2296,10 +2296,6 @@ struct elf_aarch64_link_hash_table
/* The number of bytes in the subsequent PLT etries. */
bfd_size_type plt_entry_size;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Small local sym cache. */
struct sym_cache sym_cache;
@ -6916,11 +6912,11 @@ elfNN_aarch64_adjust_dynamic_symbol (struct bfd_link_info *info,
runtime process image. */
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += RELOC_SIZE (htab);
htab->root.srelbss->size += RELOC_SIZE (htab);
h->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->root.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
@ -7914,24 +7910,11 @@ static bfd_boolean
elfNN_aarch64_create_dynamic_sections (bfd *dynobj,
struct bfd_link_info *info)
{
struct elf_aarch64_link_hash_table *htab;
/* We need to create .got section. */
if (!aarch64_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab = elf_aarch64_hash_table (info);
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->sdynbss || (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
return _bfd_elf_create_dynamic_sections (dynobj, info);
}
@ -8533,7 +8516,8 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|| s == htab->root.sgot
|| s == htab->root.sgotplt
|| s == htab->root.iplt
|| s == htab->root.igotplt || s == htab->sdynbss)
|| s == htab->root.igotplt
|| s == htab->root.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -8944,7 +8928,7 @@ do_glob_dat:
if (h->dynindx == -1
|| (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
|| htab->srelbss == NULL)
|| htab->root.srelbss == NULL)
abort ();
rela.r_offset = (h->root.u.def.value
@ -8952,8 +8936,8 @@ do_glob_dat:
+ h->root.u.def.section->output_offset);
rela.r_info = ELFNN_R_INFO (h->dynindx, AARCH64_R (COPY));
rela.r_addend = 0;
loc = htab->srelbss->contents;
loc += htab->srelbss->reloc_count++ * RELOC_SIZE (htab);
loc = htab->root.srelbss->contents;
loc += htab->root.srelbss->reloc_count++ * RELOC_SIZE (htab);
bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
}

View File

@ -123,8 +123,6 @@ struct riscv_elf_link_hash_table
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
asection *sdyntdata;
/* Small local sym to section mapping cache. */
@ -363,17 +361,15 @@ riscv_elf_create_dynamic_sections (bfd *dynobj,
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
{
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
htab->sdyntdata =
bfd_make_section_anyway_with_flags (dynobj, ".tdata.dyn",
SEC_ALLOC | SEC_THREAD_LOCAL);
}
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && (!htab->srelbss || !htab->sdyntdata)))
if (!htab->elf.splt || !htab->elf.srelplt || !htab->elf.sdynbss
|| (!bfd_link_pic (info) && (!htab->elf.srelbss || !htab->sdyntdata)))
abort ();
return TRUE;
@ -971,14 +967,14 @@ riscv_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_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += sizeof (ElfNN_External_Rela);
htab->elf.srelbss->size += sizeof (ElfNN_External_Rela);
h->needs_copy = 1;
}
if (eh->tls_type & ~GOT_NORMAL)
return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdyntdata);
return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss);
return _bfd_elf_adjust_dynamic_copy (info, h, htab->elf.sdynbss);
}
/* Allocate space in .plt, .got and associated reloc sections for
@ -1332,7 +1328,7 @@ riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
if (s == htab->elf.splt
|| s == htab->elf.sgot
|| s == htab->elf.sgotplt
|| s == htab->sdynbss)
|| s == htab->elf.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -2400,7 +2396,7 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd,
rela.r_offset = sec_addr (h->root.u.def.section) + h->root.u.def.value;
rela.r_info = ELFNN_R_INFO (h->dynindx, R_RISCV_COPY);
rela.r_addend = 0;
riscv_elf_append_rela (output_bfd, htab->srelbss, &rela);
riscv_elf_append_rela (output_bfd, htab->elf.srelbss, &rela);
}
/* Mark some specially defined symbols as absolute. */

View File

@ -451,8 +451,6 @@ struct mips_elf_link_hash_table
/* Shortcuts to some dynamic sections, or NULL if they are not
being used. */
asection *srelbss;
asection *sdynbss;
asection *srelplt2;
asection *sstubs;
@ -7893,16 +7891,6 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (!_bfd_elf_create_dynamic_sections (abfd, info))
return FALSE;
/* Cache the sections created above. */
htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
if (htab->is_vxworks)
htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
if (!htab->sdynbss
|| (htab->is_vxworks && !htab->srelbss && !bfd_link_pic (info))
|| !htab->root.srelplt
|| !htab->root.splt)
abort ();
/* Do the usual VxWorks handling. */
if (htab->is_vxworks
&& !elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2))
@ -9386,7 +9374,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
if (htab->is_vxworks)
htab->srelbss->size += sizeof (Elf32_External_Rela);
htab->root.srelbss->size += sizeof (Elf32_External_Rela);
else
mips_elf_allocate_dynamic_relocations (dynobj, info, 1);
h->needs_copy = 1;
@ -9396,7 +9384,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
dynamic will now refer to the local copy instead. */
hmips->possibly_dynamic_relocs = 0;
return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss);
return _bfd_elf_adjust_dynamic_copy (info, h, htab->root.sdynbss);
}
/* This function is called after all the input files have been read,
@ -9918,7 +9906,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
&& s != htab->root.sgot
&& s != htab->root.sgotplt
&& s != htab->sstubs
&& s != htab->sdynbss)
&& s != htab->root.sdynbss)
{
/* It's not one of our sections, so don't allocate space. */
continue;
@ -11317,10 +11305,10 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd,
rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_COPY);
rel.r_addend = 0;
bfd_elf32_swap_reloca_out (output_bfd, &rel,
htab->srelbss->contents
+ (htab->srelbss->reloc_count
htab->root.srelbss->contents
+ (htab->root.srelbss->reloc_count
* sizeof (Elf32_External_Rela)));
++htab->srelbss->reloc_count;
++htab->root.srelbss->reloc_count;
}
/* If this is a mips16/microMIPS symbol, force the value to be even. */

View File

@ -1206,10 +1206,6 @@ _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj,
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (htab->is_vxworks)
{
if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
@ -1230,8 +1226,8 @@ _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj,
}
}
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
if (!htab->elf.splt || !htab->elf.srelplt || !htab->elf.sdynbss
|| (!bfd_link_pic (info) && !htab->elf.srelbss))
abort ();
return TRUE;
@ -2205,11 +2201,11 @@ _bfd_sparc_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_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += SPARC_ELF_RELA_BYTES (htab);
htab->elf.srelbss->size += SPARC_ELF_RELA_BYTES (htab);
h->needs_copy = 1;
}
s = htab->sdynbss;
s = htab->elf.sdynbss;
return _bfd_elf_adjust_dynamic_copy (info, h, s);
}
@ -2689,7 +2685,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
if (s == htab->elf.splt
|| s == htab->elf.sgot
|| s == htab->sdynbss
|| s == htab->elf.sdynbss
|| s == htab->elf.iplt
|| s == htab->elf.sgotplt)
{

View File

@ -46,10 +46,6 @@ struct _bfd_sparc_elf_link_hash_table
{
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
union
{
bfd_signed_vma refcount;

View File

@ -855,10 +855,6 @@ struct tilegx_elf_link_hash_table
void (*put_word) (bfd *, bfd_vma, void *);
const char *dynamic_interpreter;
/* Short-cuts to get to dynamic linker sections. */
asection *sdynbss;
asection *srelbss;
/* Whether LE transition has been disabled for some of the
sections. */
bfd_boolean disable_le_transition;
@ -1500,26 +1496,10 @@ bfd_boolean
tilegx_elf_create_dynamic_sections (bfd *dynobj,
struct bfd_link_info *info)
{
struct tilegx_elf_link_hash_table *htab;
htab = tilegx_elf_hash_table (info);
BFD_ASSERT (htab != NULL);
if (!tilegx_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
return _bfd_elf_create_dynamic_sections (dynobj, info);
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
@ -2453,11 +2433,11 @@ tilegx_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_ALLOC) != 0 && h->size != 0)
{
htab->srelbss->size += TILEGX_ELF_RELA_BYTES (htab);
htab->elf.srelbss->size += TILEGX_ELF_RELA_BYTES (htab);
h->needs_copy = 1;
}
return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss);
return _bfd_elf_adjust_dynamic_copy (info, h, htab->elf.sdynbss);
}
/* Allocate space in .plt, .got and associated reloc sections for
@ -2846,7 +2826,7 @@ tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (s == htab->elf.splt
|| s == htab->elf.sgot
|| s == htab->elf.sgotplt
|| s == htab->sdynbss)
|| s == htab->elf.sdynbss)
{
/* Strip this section if we don't need it; see the
comment below. */
@ -4207,7 +4187,7 @@ tilegx_elf_finish_dynamic_symbol (bfd *output_bfd,
/* This symbols needs a copy reloc. Set it up. */
BFD_ASSERT (h->dynindx != -1);
s = htab->srelbss;
s = htab->elf.srelbss;
BFD_ASSERT (s != NULL);
rela.r_offset = (h->root.u.def.value