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.
+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
asection *srelgot;
asection *splt;
asection *srelplt;
+ asection *sdynbss;
+ asection *srelbss;
asection *igotplt;
asection *iplt;
asection *irelplt;
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 *
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;
(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)
{
{
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;
}
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;
#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
/* 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;
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))
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;
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
&& 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;
&& (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;
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;
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;
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);
}
}
}
else if (sec == htab->etab.sgot
- || sec == htab->sdynbss)
+ || sec == htab->etab.sdynbss)
;
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, sec), ".rela"))
{
|| 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
/* Short-cuts to get to dynamic linker sections. */
asection *interp;
- asection *sdynbss;
- asection *srelbss;
asection *plt_eh_frame;
asection *plt_got;
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))
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);
}
|| s == htab->elf.igotplt
|| s == htab->plt_got
|| s == htab->plt_eh_frame
- || s == htab->sdynbss)
+ || s == htab->elf.sdynbss)
{
/* Strip these too. */
}
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;
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;
htab->etab.hgot = eh;
- htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
- htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
-
return TRUE;
}
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);
}
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. */
|| 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
{
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;
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
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;
}
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))
#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
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. */
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:
&& (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
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
{
asection *srel;
- srel = htab->srelbss;
+ srel = htab->root.srelbss;
BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
{
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;
};
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
{
asection *srel;
- srel = htab->srelbss;
+ srel = htab->root.srelbss;
BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf32_External_Rela);
h->needs_copy = 1;
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. */
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
#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
/* Short-cuts to get to dynamic linker sections. */
asection *glink;
- asection *dynbss;
- asection *relbss;
asection *dynsbss;
asection *relsbss;
elf_linker_section_t sdata[2];
&& !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;
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);
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
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;
|| 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. */
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);
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
- asection *sdynbss;
- asection *srelbss;
asection *irelifunc;
union
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
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);
}
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)
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
+ 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);
}
#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
{
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;
|| ! 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;
}
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
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. */
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);
}
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. */
{
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;
};
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. */
.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
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. */
/* 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
#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
struct ppc_link_hash_entry *dot_syms;
/* Shortcuts to get to dynamic linker sections. */
- asection *dynbss;
- asection *relbss;
asection *glink;
asection *sfpr;
asection *brlt;
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 *
.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);
}
|| 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. */
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
+ 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);
}
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
- asection *sdynbss;
- asection *srelbss;
asection *irelifunc;
union {
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
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);
}
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)
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
+ 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);
}
#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
/* Short-cuts to get to dynamic linker sections. */
asection *interp;
- asection *sdynbss;
- asection *srelbss;
asection *plt_eh_frame;
asection *plt_bnd;
asection *plt_got;
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)
{
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);
}
|| 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. */
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
+ 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;
(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
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
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
+ htab->srelbss = s;
}
}
/* 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;
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);
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);
}
|| 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. */
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
+ 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);
}
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. */
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;
.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
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. */
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. */
/* Shortcuts to some dynamic sections, or NULL if they are not
being used. */
- asection *srelbss;
- asection *sdynbss;
asection *srelplt2;
asection *sstubs;
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))
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;
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);
}
\f
/* This function is called after all the input files have been read,
&& 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;
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. */
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))
}
}
- 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;
.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);
}
if (s == htab->elf.splt
|| s == htab->elf.sgot
- || s == htab->sdynbss
+ || s == htab->elf.sdynbss
|| s == htab->elf.iplt
|| s == htab->elf.sgotplt)
{
{
struct elf_link_hash_table elf;
- /* Short-cuts to get to dynamic linker sections. */
- asection *sdynbss;
- asection *srelbss;
-
union
{
bfd_signed_vma refcount;
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;
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. */
.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
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. */
/* 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