2016-11-23 Alan Modra <amodra@gmail.com>
+ * elf-m10300.c (mn10300_elf_check_relocs): Use elf htab shortcuts
+ to dynamic sections.
+ (mn10300_elf_final_link_relocate): Likewise.
+ (_bfd_mn10300_elf_adjust_dynamic_symbol): Likewise.
+ (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
+ (_bfd_mn10300_elf_finish_dynamic_symbol): Likewise.
+ (_bfd_mn10300_elf_finish_dynamic_sections): Likewise.
+ * elf32-bfin.c (bfin_check_relocs): Likewise.
+ (bfin_relocate_section): Likewise.
+ (bfin_gc_sweep_hook): Likewise.
+ (struct bfinfdpic_elf_link_hash_table): Delete sgot, sgotrel, splt
+ and spltrel.
+ (bfinfdpic_got_section, bfinfdpic_gotrel_section,
+ bfinfdpic_plt_section, bfinfdpic_pltrel_section): Define using elf
+ shortcut sections.
+ (_bfin_create_got_section): Use elf htab shortcuts to dyn sections.
+ Delete dead code.
+ (bfin_finish_dynamic_symbol): Use elf htab shortcuts to dyn sections.
+ (bfin_size_dynamic_sections): Likewise.
+ * elf32-cr16.c (_bfd_cr16_elf_create_got_section): Likewise.
+ (cr16_elf_check_relocs): Likewise.
+ (cr16_elf_final_link_relocate): Likewise.
+ (_bfd_cr16_elf_create_dynamic_sections): Likewise.
+ (_bfd_cr16_elf_adjust_dynamic_symbol): Likewise.
+ (_bfd_cr16_elf_size_dynamic_sections): Likewise.
+ (_bfd_cr16_elf_finish_dynamic_symbol): Likewise.
+ (_bfd_cr16_elf_finish_dynamic_sections): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ (elf_cris_finish_dynamic_symbol): Likewise.
+ (elf_cris_finish_dynamic_sections): Likewise.
+ (cris_elf_gc_sweep_hook): Likewise.
+ (elf_cris_adjust_gotplt_to_got): Likewise.
+ (elf_cris_adjust_dynamic_symbol): Likewise.
+ (cris_elf_check_relocs): Likewise. Delete dead code.
+ (elf_cris_size_dynamic_sections): Use elf htab shortcuts to dynamic
+ sections.
+ (elf_cris_discard_excess_program_dynamics): Likewise.
+ * elf32-frv.c (struct frvfdpic_elf_link_hash_table): Delete sgot,
+ sgotrel, splt and spltrel.
+ (frvfdpic_got_section, frvfdpic_gotrel_section,
+ frvfdpic_plt_section, frvfdpic_pltrel_section): Define using elf
+ shortcut sections.
+ (_frv_create_got_section): Likewise.
+ * elf32-hppa.c (struct elf32_hppa_link_hash_table): Delete sgot,
+ srelgot, splt and srelplt.
+ (hppa_build_one_stub): Use elf htab shortcuts to dynamic sections.
+ (elf32_hppa_create_dynamic_sections): Likewise.
+ (elf32_hppa_check_relocs): Likewise.
+ (allocate_plt_static): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (elf32_hppa_size_dynamic_sections): Likewise.
+ (elf32_hppa_relocate_section): Likewise.
+ (elf32_hppa_finish_dynamic_symbol): Likewise.
+ (elf32_hppa_finish_dynamic_sections): Likewise.
+ * elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise.
+ * elf32-lm32.c (struct elf_lm32_link_hash_table): Delete sgot,
+ sgotplt, srelgot, splt and srelplt.
+ (lm32fdpic_got_section, lm32fdpic_gotrel_section): Define using elf
+ shortcut sections.
+ (create_got_section): Delete. Use _bfd_elf_create_got_section instead.
+ (lm32_elf_relocate_section): Use elf htab shortcuts to dyn sections.
+ (lm32_elf_check_relocs): Likewise.
+ (lm32_elf_finish_dynamic_sections): Likewise.
+ (lm32_elf_finish_dynamic_symbol): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (lm32_elf_size_dynamic_sections): Likewise.
+ (lm32_elf_create_dynamic_sections): Likewise.
+ * elf32-m32c.c (m32c_elf_relocate_section): Likewise.
+ (m32c_elf_check_relocs): Likewise.
+ (m32c_elf_finish_dynamic_sections): Likewise.
+ (m32c_elf_always_size_sections): Likewise.
+ * elf32-m32r.c (struct elf_m32r_link_hash_table): Delete sgot,
+ sgotplt, srelgot, splt and srelplt.
+ (create_got_section): Delete. Use _bfd_elf_create_got_section instead.
+ (m32r_elf_create_dynamic_sections): Use elf htab shortcuts to dynamic
+ sections.
+ (allocate_dynrelocs): Likewise.
+ (m32r_elf_size_dynamic_sections): Likewise.
+ (m32r_elf_relocate_section): Likewise.
+ (m32r_elf_finish_dynamic_symbol): Likewise.
+ (m32r_elf_finish_dynamic_sections): Likewise.
+ (m32r_elf_check_relocs): Likewise.
+ * elf32-m68k.c (elf_m68k_partition_multi_got): Likewise.
+ (elf_m68k_check_relocs): Likewise.
+ (elf_m68k_adjust_dynamic_symbol): Likewise.
+ (elf_m68k_size_dynamic_sections): Likewise.
+ (elf_m68k_relocate_section): Likewise.
+ (elf_m68k_finish_dynamic_symbol): Likewise.
+ (elf_m68k_finish_dynamic_sections): Likewise.
+ * elf32-metag.c (struct elf_metag_link_hash_table): Delete sgot,
+ sgotplt, srelgot, splt and srelplt.
+ (elf_metag_relocate_section): Use elf htab shortcuts to dynamic
+ sections.
+ (elf_metag_create_dynamic_sections): Likewise. Allocate got header
+ here in .got.
+ (elf_metag_check_relocs): Use elf htab shortcuts to dynamic sections.
+ (allocate_dynrelocs): Likewise.
+ (elf_metag_size_dynamic_sections): Likewise.
+ (elf_metag_finish_dynamic_symbol): Likewise.
+ (elf_metag_finish_dynamic_sections): Likewise.
+ (elf_metag_size_stubs): Likewise.
+ (elf_backend_got_header_size): Don't define.
+ (elf_backend_want_got_plt): Define.
+ * elf32-microblaze.c (struct elf32_mb_link_hash_table): Delete sgot,
+ sgotplt, srelgot, splt and srelpl.
+ (microblaze_elf_relocate_section): Use elf htab shortcuts to dynamic
+ sections.
+ (create_got_section): Delete. Use _bfd_elf_create_got_section instead.
+ (microblaze_elf_check_relocs): Use elf htab shortcuts to dyn sections.
+ (microblaze_elf_create_dynamic_sections): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (microblaze_elf_size_dynamic_sections): Likewise.
+ (microblaze_elf_finish_dynamic_symbol): Likewise.
+ (microblaze_elf_finish_dynamic_sections): Likewise.
+ * elf32-nds32.c (nds32_elf_link_hash_table_create): Don't NULL
+ already zero fields.
+ (create_got_section): Delete. Use _bfd_elf_create_got_section instead.
+ (nds32_elf_create_dynamic_sections): Use elf htab shortcuts to dynamic
+ sections.
+ (allocate_dynrelocs): Likewise.
+ (nds32_elf_size_dynamic_sections): Likewise.
+ (nds32_elf_relocate_section): Likewise.
+ (nds32_elf_finish_dynamic_symbol): Likewise.
+ (nds32_elf_finish_dynamic_sections): Likewise.
+ (nds32_elf_check_relocs): Likewise.
+ (calculate_plt_memory_address): Likewise.
+ (calculate_got_memory_address): Likewise.
+ * elf32-nds32.h (struct elf_nds32_link_hash_table): Delete sgot,
+ sgotplt, srelgot, splt and srelplt.
+ * elf32-or1k.c (struct elf_or1k_link_hash_table): Likewise.
+ (or1k_elf_relocate_section): Use elf htab shortcuts to dyn sections.
+ (create_got_section): Delete. Use _bfd_elf_create_got_section instead.
+ (or1k_elf_check_relocs): Use elf htab shortcuts to dynamic sections.
+ (or1k_elf_finish_dynamic_sections): Likewise.
+ (or1k_elf_finish_dynamic_symbol): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (or1k_elf_size_dynamic_sections): Likewise.
+ (or1k_elf_create_dynamic_sections): Likewise.
+ * elf32-ppc.c (struct ppc_elf_link_hash_table): Delete got, relgot,
+ plt, relplt, iplt, reliplt and sgotplt.
+ (ppc_elf_create_got): Use elf htab shortcuts to dynamic sections.
+ (ppc_elf_create_glink): Likewise.
+ (ppc_elf_create_dynamic_sections): Likewise.
+ (ppc_elf_check_relocs): Likewise.
+ (ppc_elf_select_plt_layout): Likewise.
+ (ppc_elf_tls_setup): Likewise.
+ (allocate_got): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (ppc_elf_size_dynamic_sections): Likewise.
+ (ppc_elf_relax_section): Likewise.
+ (ppc_elf_relocate_section): Likewise.
+ (ppc_elf_finish_dynamic_symbol): Likewise.
+ (ppc_elf_reloc_type_class): Likewise.
+ (ppc_elf_finish_dynamic_sections): Likewise.
+ * elf32-rl78.c (rl78_elf_relocate_section): Likewise.
+ (rl78_elf_check_relocs): Likewise.
+ (rl78_elf_finish_dynamic_sections): Likewise.
+ (rl78_elf_always_size_sections): Likewise.
+ * elf32-s390.c (create_got_section): Delete.
+ (elf_s390_create_dynamic_sections): Use _bfd_elf_create_got_section.
+ (elf_s390_check_relocs): Likewise.
+ * elf32-score.c (score_elf_create_got_section): Set elf shortcuts.
+ (s3_bfd_score_elf_finish_dynamic_sections): Use elf shortcuts.
+ * elf32-score7.c (score_elf_create_got_section): As above.
+ (s7_bfd_score_elf_finish_dynamic_sections): As above.
+ * elf32-sh.c (struct elf_sh_link_hash_table): Delete sgot,
+ sgotplt, srelgot, splt and srelplt.
+ (create_got_section): Don't set them.
+ (sh_elf_create_dynamic_sections): Use elf htab shortcuts to dynamic
+ sections.
+ (allocate_dynrelocs): Likewise.
+ (sh_elf_size_dynamic_sections): Likewise.
+ (sh_elf_add_rofixup): Likewise.
+ (sh_elf_relocate_section): Likewise.
+ (sh_elf_check_relocs): Likewise.
+ (sh_elf_finish_dynamic_symbol): Likewise.
+ (sh_elf_finish_dynamic_sections): Likewise.
+ * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
+ * elf32-tilepro.c (tilepro_elf_create_got_section): Likewise.
+ * elf32-vax.c (elf_vax_check_relocs): Likewise.
+ (elf_vax_adjust_dynamic_symbol): Likewise.
+ (elf_vax_always_size_sections): Likewise.
+ (elf_vax_instantiate_got_entries): Likewise.
+ (elf_vax_relocate_section): Likewise.
+ (elf_vax_finish_dynamic_symbol): Likewise.
+ (elf_vax_finish_dynamic_sections): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
+ (xstormy16_elf_always_size_sections): Likewise.
+ (xstormy16_elf_relocate_section): Likewise.
+ (xstormy16_elf_finish_dynamic_sections): Likewise.
+ * elf32-xtensa.c (struct elf_xtensa_link_hash_table): Delete sgot,
+ sgotplt, srelgot, splt and srelplt.
+ (elf_xtensa_create_dynamic_sections): Use elf htab shortcuts to
+ dynamic sections.
+ (elf_xtensa_allocate_dynrelocs): Likewise.
+ (elf_xtensa_allocate_local_got_size): Likewise.
+ (elf_xtensa_size_dynamic_sections): Likewise.
+ (elf_xtensa_relocate_section): Likewise.
+ (elf_xtensa_finish_dynamic_sections): Likewise.
+ (shrink_dynamic_reloc_sections): Likewise.
+ (elf_xtensa_get_plt_section): Likewise.
+ (elf_xtensa_get_gotplt_section): Likewise.
+ (xtensa_callback_required_dependence): Likewise.
+ * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Set elf htab
+ shortcuts to dynamic sections.
+ (elf64_alpha_adjust_dynamic_symbol): Use elf htab shortcuts to
+ dynamic sections.
+ (elf64_alpha_size_plt_section): Likewise.
+ (elf64_alpha_size_rela_got_1): Likewise.
+ (elf64_alpha_size_rela_got_section): Likewise.
+ (elf64_alpha_relocate_section): Likewise.
+ (elf64_alpha_finish_dynamic_symbol): Likewise.
+ (elf64_alpha_finish_dynamic_sections): Likewise.
+ * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
+ * elf64-s390.c (create_got_section): Delete.
+ (elf_s390_create_dynamic_sections): Use _bfd_elf_create_got_section.
+ (elf_s390_check_relocs): Likewise.
+ * elf64-sh64.c (sh_elf64_relocate_section): Use elf htab shortcuts to
+ dynamic sections.
+ (sh_elf64_check_relocs): Likewise.
+ (sh64_elf64_adjust_dynamic_symbol): Likewise.
+ (sh64_elf64_size_dynamic_sections): Likewise.
+ (sh64_elf64_finish_dynamic_symbol): Likewise.
+ (sh64_elf64_finish_dynamic_sections): Likewise.
+ * elflink.c (_bfd_elf_create_got_section): Likewise.
+ * elfnn-aarch64.c (aarch64_elf_create_got_section): Likewise.
+ * elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise.
+ (elfNN_ia64_finish_dynamic_sections): Likewise.
+ * elfnn-riscv.c (riscv_elf_create_got_section): Likewise.
+ * elfxx-mips.c (struct mips_elf_link_hash_table): Delete srellt,
+ sgotplt, splt and sgot.
+ (mips_elf_initialize_tls_slots): Use elf htab shortcuts to dynamic
+ sections.
+ (mips_elf_gotplt_index): Likewise.
+ (mips_elf_primary_global_got_index): Likewise.
+ (mips_elf_global_got_index): Likewise.
+ (mips_elf_got_offset_from_index): Likewise.
+ (mips_elf_create_local_got_entry): Likewise.
+ (mips_elf_create_got_section): Likewise.
+ (mips_elf_calculate_relocation): Likewise.
+ (_bfd_mips_elf_create_dynamic_sections): Likewise.
+ (_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
+ (mips_elf_lay_out_got): Likewise.
+ (mips_elf_set_plt_sym_value): Likewise.
+ (_bfd_mips_elf_size_dynamic_sections): Likewise.
+ (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
+ (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
+ (mips_finish_exec_plt): Likewise.
+ (mips_vxworks_finish_exec_plt): Likewise.
+ (mips_vxworks_finish_shared_plt): Likewise.
+ (_bfd_mips_elf_finish_dynamic_sections): Likewise.
+ * elfxx-sparc.c (sparc_finish_dyn): Likewise.
+ * elfxx-tilegx.c (tilegx_elf_create_got_section): Likewise.
+
+2016-11-23 Alan Modra <amodra@gmail.com>
+
* po/BLD-POTFILES.in: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
default: tls_type = GOT_NORMAL; break;
}
- if (sgot == NULL)
- {
- sgot = htab->root.sgot;
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL
- && (h != NULL || bfd_link_pic (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
- srelgot = bfd_make_section_anyway_with_flags (dynobj,
- ".rela.got",
- flags);
- if (srelgot == NULL
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- goto fail;
- }
- }
+ sgot = htab->root.sgot;
+ srelgot = htab->root.srelgot;
+ BFD_ASSERT (sgot != NULL && srelgot != NULL);
if (r_type == R_MN10300_TLS_LD)
{
if (!htab->tls_ldm_got.rel_emitted)
{
- asection * srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ asection *srelgot = htab->root.srelgot;
Elf_Internal_Rela rel;
BFD_ASSERT (srelgot != NULL);
if (bfd_link_pic (info))
{
- asection * srelgot;
+ asection *srelgot = htab->root.srelgot;;
Elf_Internal_Rela outrel;
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma
s->size += 4;
/* We also need to make an entry in the .rela.plt section. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = htab->root.srelplt;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf32_External_Rela);
if (htab->tls_ldm_got.refcount > 0)
{
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = htab->root.srelgot;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf32_External_Rela);
}
splt = htab->root.splt;
sgot = htab->root.sgotplt;
- srel = bfd_get_linker_section (dynobj, ".rela.plt");
+ srel = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
/* Get the index in the procedure linkage table which
/* This symbol has an entry in the global offset table. Set it up. */
sgot = htab->root.sgot;
- srel = bfd_get_linker_section (dynobj, ".rela.got");
+ srel = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srel != NULL);
rel.r_offset = (sgot->output_section->vma
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char * name;
asection * s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
break;
case DT_PLTGOT:
- name = ".got";
+ s = htab->root.sgot;
goto get_vma;
case DT_JMPREL:
- name = ".rela.plt";
+ s = htab->root.srelplt;
get_vma:
- s = bfd_get_linker_section (dynobj, name);
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = htab->root.srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = htab->root.srelplt;
if (s != NULL)
dyn.d_un.d_val -= s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
return FALSE;
}
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL && (h != NULL || bfd_link_pic (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
- srelgot = bfd_make_section_anyway_with_flags (dynobj,
- ".rela.got",
- flags);
- if (srelgot == NULL
- || !bfd_set_section_alignment (dynobj, srelgot, 2))
- return FALSE;
- }
- }
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
+ BFD_ASSERT (sgot != NULL);
if (h != NULL)
{
{
bfd_vma off;
- if (dynobj == NULL)
- {
- /* Create the .got section. */
- elf_hash_table (info)->dynobj = dynobj = output_bfd;
- if (!_bfd_elf_create_got_section (dynobj, info))
- return FALSE;
- }
-
- if (sgot == NULL)
+ if (dynobj == NULL)
{
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
+ /* Create the .got section. */
+ elf_hash_table (info)->dynobj = dynobj = output_bfd;
+ if (!_bfd_elf_create_got_section (dynobj, info))
+ return FALSE;
}
+ sgot = elf_hash_table (info)->sgot;
+ BFD_ASSERT (sgot != NULL);
+
if (h != NULL)
{
bfd_boolean dyn;
Elf_Internal_Rela outrel;
bfd_byte *loc;
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
BFD_ASSERT (s != NULL);
outrel.r_offset = (sgot->output_section->vma
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
- sgot = bfd_get_linker_section (dynobj, ".got");
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
{
struct elf_link_hash_table elf;
- /* A pointer to the .got section. */
- asection *sgot;
- /* A pointer to the .rel.got section. */
- asection *sgotrel;
/* A pointer to the .rofixup section. */
asection *sgotfixup;
- /* A pointer to the .plt section. */
- asection *splt;
- /* A pointer to the .rel.plt section. */
- asection *spltrel;
/* GOT base offset. */
bfd_vma got0;
/* Location of the first non-lazy PLT entry, i.e., the number of
== BFIN_ELF_DATA ? ((struct bfinfdpic_elf_link_hash_table *) ((info)->hash)) : NULL)
#define bfinfdpic_got_section(info) \
- (bfinfdpic_hash_table (info)->sgot)
+ (bfinfdpic_hash_table (info)->elf.sgot)
#define bfinfdpic_gotrel_section(info) \
- (bfinfdpic_hash_table (info)->sgotrel)
+ (bfinfdpic_hash_table (info)->elf.srelgot)
#define bfinfdpic_gotfixup_section(info) \
(bfinfdpic_hash_table (info)->sgotfixup)
#define bfinfdpic_plt_section(info) \
- (bfinfdpic_hash_table (info)->splt)
+ (bfinfdpic_hash_table (info)->elf.splt)
#define bfinfdpic_pltrel_section(info) \
- (bfinfdpic_hash_table (info)->spltrel)
+ (bfinfdpic_hash_table (info)->elf.srelplt)
#define bfinfdpic_relocs_info(info) \
(bfinfdpic_hash_table (info)->relocs_info)
#define bfinfdpic_got_initial_offset(info) \
int ptralign;
/* This function may be called more than once. */
- s = bfd_get_linker_section (abfd, ".got");
+ s = elf_hash_table (info)->sgot;
if (s != NULL)
return TRUE;
pltflags = flags;
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
+ elf_hash_table (info)->sgot = s;
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
- if (bed->want_got_plt)
- {
- s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
- if (s == NULL
- || !bfd_set_section_alignment (abfd, s, ptralign))
- return FALSE;
- }
-
if (bed->want_got_sym)
{
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
data for the got. */
if (IS_FDPIC (abfd))
{
- bfinfdpic_got_section (info) = s;
bfinfdpic_relocs_info (info) = htab_try_create (1,
bfinfdpic_relocs_info_hash,
bfinfdpic_relocs_info_eq,
struct elf_link_hash_entry *h,
Elf_Internal_Sym * sym)
{
- bfd *dynobj;
-
- dynobj = elf_hash_table (info)->dynobj;
-
if (h->got.offset != (bfd_vma) - 1)
{
asection *sgot;
/* This symbol has an entry in the global offset table.
Set it up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srela = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srela = elf_hash_table (info)->srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
not actually use these entries. Reset the size of .rela.got,
which will cause it to get stripped from the output file
below. */
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
if (s != NULL)
s->size = 0;
}
asection * s;
struct elf_link_hash_entry * h;
const struct elf_backend_data * bed = get_elf_backend_data (abfd);
+ struct elf_link_hash_table *htab = elf_hash_table (info);
int ptralign;
/* This function may be called more than once. */
- if (bfd_get_linker_section (abfd, ".got") != NULL)
+ if (htab->sgot != NULL)
return TRUE;
switch (bed->s->arch_size)
| SEC_LINKER_CREATED);
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
+ htab->sgot= s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
if (bed->want_got_plt)
{
s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
+ htab->sgotplt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
because we don't want to define the symbol if we are not creating
a global offset table. */
h = _bfd_elf_define_linkage_sym (abfd, info, s, "_GLOBAL_OFFSET_TABLE_");
- elf_hash_table (info)->hgot = h;
+ htab->hgot = h;
if (h == NULL)
return FALSE;
case R_CR16_GOTC_REGREL20:
/* This symbol requires a global offset table entry. */
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL
- && (h != NULL || bfd_link_executable (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
- srelgot = bfd_make_section_anyway_with_flags (dynobj,
- ".rela.got",
- flags);
- if (srelgot == NULL
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- goto fail;
- }
- }
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
+ BFD_ASSERT (sgot != NULL && srelgot != NULL);
if (h != NULL)
{
unsigned short r_type = howto->type;
bfd_byte *hit_data = contents + offset;
bfd_vma reloc_bits, check, Rvalue1;
- bfd * dynobj;
-
- dynobj = elf_hash_table (info)->dynobj;
switch (r_type)
{
}
else if (r_type == R_CR16_GOT_REGREL20)
{
- asection * sgot = bfd_get_linker_section (dynobj, ".got");
+ asection *sgot = elf_hash_table (info)->sgot;
if (h != NULL)
{
}
else if (r_type == R_CR16_GOTC_REGREL20)
{
- asection * sgot;
- sgot = bfd_get_linker_section (dynobj, ".got");
+ asection *sgot = elf_hash_table (info)->sgot;
if (h != NULL)
{
flagword flags;
asection * s;
const struct elf_backend_data * bed = get_elf_backend_data (abfd);
+ struct elf_link_hash_table *htab = elf_hash_table (info);
int ptralign = 0;
switch (bed->s->arch_size)
(bed->default_use_rela_p
? ".rela.plt" : ".rel.plt"),
flags | SEC_READONLY);
+ htab->srelplt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- s = bfd_get_linker_section (dynobj, ".got.plt");
+ s = elf_hash_table (info)->sgotplt;
BFD_ASSERT (s != NULL);
s->size += 4;
/* We also need to make an entry in the .rela.plt section. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf32_External_Rela);
not actually use these entries. Reset the size of .rela.got,
which will cause it to get stripped from the output file
below. */
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
if (s != NULL)
s->size = 0;
}
/* This symbol has an entry in the global offset table. Set it up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srel = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srel = elf_hash_table (info)->srelgot;
BFD_ASSERT (sgot != NULL && srel != NULL);
rel.r_offset = (sgot->output_section->vma
dynobj = elf_hash_table (info)->dynobj;
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
+ sgot = elf_hash_table (info)->sgotplt;
BFD_ASSERT (sgot != NULL);
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char * name;
asection * s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
break;
case DT_PLTGOT:
- name = ".got.plt";
+ s = elf_hash_table (info)->sgotplt;
goto get_vma;
case DT_JMPREL:
- name = ".rela.plt";
+ s = elf_hash_table (info)->srelplt;
get_vma:
- s = bfd_get_linker_section (dynobj, name);
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s != NULL)
dyn.d_un.d_val -= s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
if (htab == NULL)
return FALSE;
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
if (dynobj != NULL)
{
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got");
+ splt = htab->root.splt;
+ sgot = htab->root.sgot;
}
for (rel = relocs; rel < relend; rel ++)
if (h != NULL
&& ((struct elf_cris_link_hash_entry *) h)->gotplt_offset != 0)
{
- asection *sgotplt
- = bfd_get_linker_section (dynobj, ".got.plt");
+ asection *sgotplt = htab->root.sgotplt;
bfd_vma got_offset;
BFD_ASSERT (h->dynindx != -1);
Elf_Internal_Rela outrel;
bfd_byte *loc;
- if (srelgot == NULL)
- srelgot
- = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma
if (htab->dtpmod_refcount > 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
- asection *sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
+ asection *sgotplt = htab->root.sgotplt;
BFD_ASSERT (sgotplt != NULL);
if (bfd_link_pic (info))
Elf_Internal_Rela outrel;
bfd_byte *loc;
- if (srelgot == NULL)
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
loc = srelgot->contents;
loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_put_32 (output_bfd, 0, sgot->contents + off);
bfd_put_32 (output_bfd, 0, sgot->contents + off + 4);
- if (srelgot == NULL)
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
if (h != NULL && h->dynindx != -1)
else
local_got_offsets[r_symndx] |= 1;
- if (srelgot == NULL)
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
if (h != NULL && h->dynindx != -1)
plt_pic_entry = elf_cris_pic_plt_entry_v32;
}
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
if (h->plt.offset != (bfd_vma) -1)
{
BFD_ASSERT (h->dynindx != -1);
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- srela = bfd_get_linker_section (dynobj, ".rela.plt");
+ splt = htab->root.splt;
+ sgotplt = htab->root.sgotplt;
+ srela = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgotplt != NULL
&& (! has_gotplt || srela != NULL));
/* This symbol has an entry in the global offset table. Set it up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srela = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = htab->root.sgot;
+ srela = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
dynobj = elf_hash_table (info)->dynobj;
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
+ sgot = elf_hash_table (info)->sgotplt;
BFD_ASSERT (sgot != NULL);
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
case DT_JMPREL:
/* Yes, we *can* have a .plt and no .plt.rela, for instance
if all symbols are found in the .got (not .got.plt). */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
dyn.d_un.d_ptr = s != NULL ? (s->output_section->vma
+ s->output_offset) : 0;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s == NULL)
dyn.d_un.d_val = 0;
else
linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s != NULL)
dyn.d_un.d_val -= s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
- sgot = bfd_get_linker_section (dynobj, ".got");
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = htab->root.sgot;
+ srelgot = htab->root.srelgot;
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
else
{
/* No GOT entry for this symbol. We need to create one. */
- bfd *dynobj = elf_hash_table (info)->dynobj;
asection *sgot;
asection *srelgot;
- BFD_ASSERT (dynobj != NULL);
- sgot = bfd_get_linker_section (dynobj, ".got");
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
/* Put accurate refcounts there. */
h->root.got.refcount += h->gotplt_refcount;
if (htab == NULL)
return FALSE;
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
/* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL
return FALSE;
}
- s = bfd_get_linker_section (dynobj, ".plt");
+ s = htab->root.splt;
BFD_ASSERT (s != NULL);
/* If this is the first .plt entry, make room for the special
= htab->next_gotplt_entry;
htab->next_gotplt_entry += 4;
- s = bfd_get_linker_section (dynobj, ".got.plt");
+ s = htab->root.sgotplt;
BFD_ASSERT (s != NULL);
s->size += 4;
/* We also need to make an entry in the .rela.plt section. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = htab->root.srelplt;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf32_External_Rela);
if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE;
- sgot = bfd_get_linker_section (dynobj, ".got");
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
}
if (local_got_refcounts == NULL)
break;
}
- /* Some relocs require a global offset table (but perhaps not a
- specific GOT entry). */
- switch (r_type)
- {
- case R_CRIS_16_DTPREL:
- case R_CRIS_32_DTPREL:
- /* Not requesting .got.rela for an executable: the contents
- of the first entry is constant there. For a shared
- library, we need .got.rela for the R_CRIS_DTPMOD
- relocation at index 3. */
- if (!bfd_link_pic (info))
- break;
- /* Fall through. */
-
- case R_CRIS_32_IE:
- case R_CRIS_32_GD:
- case R_CRIS_16_GOT_GD:
- case R_CRIS_32_GOT_GD:
- case R_CRIS_32_GOT_TPREL:
- case R_CRIS_16_GOT_TPREL:
- /* Fall through. */
-
- /* For R_CRIS_16_GOTPLT and R_CRIS_32_GOTPLT, we need a GOT
- entry only for local symbols. Unfortunately, we don't know
- until later on if there's a version script that forces the
- symbol local. We must have the .rela.got section in place
- before we know if the symbol looks global now, so we need
- to treat the reloc just like for R_CRIS_16_GOT and
- R_CRIS_32_GOT. */
- case R_CRIS_16_GOTPLT:
- case R_CRIS_32_GOTPLT:
- case R_CRIS_16_GOT:
- case R_CRIS_32_GOT:
- if (srelgot == NULL
- && (h != NULL || bfd_link_pic (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
- srelgot = bfd_make_section_anyway_with_flags (dynobj,
- ".rela.got",
- flags);
- if (srelgot == NULL
- || !bfd_set_section_alignment (dynobj, srelgot, 2))
- return FALSE;
- }
- }
- break;
-
- default:
- break;
- }
-
/* Warn and error for invalid input. */
switch (r_type)
{
if (htab == NULL)
return FALSE;
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
BFD_ASSERT (dynobj != NULL);
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (htab->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
if (bfd_link_executable (info) && !info->nointerp)
not actually use these entries. Reset the size of .rela.got,
which will cause it to get stripped from the output file
below. */
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = htab->root.srelgot;
if (s != NULL)
s->size = 0;
}
&& elf_hash_table (info)->dynamic_sections_created)
{
bfd *dynobj = elf_hash_table (info)->dynobj;
- asection *srelgot;
+ asection *srelgot = elf_hash_table (info)->srelgot;
BFD_ASSERT (dynobj != NULL);
-
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
-
BFD_ASSERT (srelgot != NULL);
srelgot->size -= sizeof (Elf32_External_Rela);
{
struct elf_link_hash_table elf;
- /* A pointer to the .got section. */
- asection *sgot;
- /* A pointer to the .rel.got section. */
- asection *sgotrel;
/* A pointer to the .rofixup section. */
asection *sgotfixup;
- /* A pointer to the .plt section. */
- asection *splt;
- /* A pointer to the .rel.plt section. */
- asection *spltrel;
/* GOT base offset. */
bfd_vma got0;
/* Location of the first non-lazy PLT entry, i.e., the number of
== FRV_ELF_DATA ? ((struct frvfdpic_elf_link_hash_table *) ((p)->hash)) : NULL)
#define frvfdpic_got_section(info) \
- (frvfdpic_hash_table (info)->sgot)
+ (frvfdpic_hash_table (info)->elf.sgot)
#define frvfdpic_gotrel_section(info) \
- (frvfdpic_hash_table (info)->sgotrel)
+ (frvfdpic_hash_table (info)->elf.srelgot)
#define frvfdpic_gotfixup_section(info) \
(frvfdpic_hash_table (info)->sgotfixup)
#define frvfdpic_plt_section(info) \
- (frvfdpic_hash_table (info)->splt)
+ (frvfdpic_hash_table (info)->elf.splt)
#define frvfdpic_pltrel_section(info) \
- (frvfdpic_hash_table (info)->spltrel)
+ (frvfdpic_hash_table (info)->elf.srelplt)
#define frvfdpic_relocs_info(info) \
(frvfdpic_hash_table (info)->relocs_info)
#define frvfdpic_got_initial_offset(info) \
int offset;
/* This function may be called more than once. */
- s = bfd_get_linker_section (abfd, ".got");
+ s = elf_hash_table (info)->sgot;
if (s != NULL)
return TRUE;
pltflags = flags;
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
+ elf_hash_table (info)->sgot = s;
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
- if (bed->want_got_plt)
- {
- s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
- if (s == NULL
- || !bfd_set_section_alignment (abfd, s, ptralign))
- return FALSE;
- }
-
if (bed->want_got_sym)
{
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
data for the got. */
if (IS_FDPIC (abfd))
{
- frvfdpic_got_section (info) = s;
frvfdpic_relocs_info (info) = htab_try_create (1,
frvfdpic_relocs_info_hash,
frvfdpic_relocs_info_eq,
s = bfd_make_section_anyway_with_flags (abfd, ".rel.got",
(flags | SEC_READONLY));
+ elf_hash_table (info)->srelgot = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
- frvfdpic_gotrel_section (info) = s;
-
/* Machine-specific. */
s = bfd_make_section_anyway_with_flags (abfd, ".rofixup",
(flags | SEC_READONLY));
Elf_Internal_Sym **all_local_syms;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
off &= ~ (bfd_vma) 1;
sym_value = (off
- + htab->splt->output_offset
- + htab->splt->output_section->vma
- - elf_gp (htab->splt->output_section->owner));
+ + htab->etab.splt->output_offset
+ + htab->etab.splt->output_section->vma
+ - elf_gp (htab->etab.splt->output_section->owner));
insn = ADDIL_DP;
#if R19_STUBS
htab = hppa_link_hash_table (info);
if (htab == NULL)
return FALSE;
- if (htab->splt != NULL)
+ if (htab->etab.splt != NULL)
return TRUE;
/* Call the generic code to do most of the work. */
if (! _bfd_elf_create_dynamic_sections (abfd, info))
return FALSE;
- htab->splt = bfd_get_linker_section (abfd, ".plt");
- htab->srelplt = bfd_get_linker_section (abfd, ".rela.plt");
-
- htab->sgot = bfd_get_linker_section (abfd, ".got");
- htab->srelgot = bfd_get_linker_section (abfd, ".rela.got");
-
htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
/* Allocate space for a GOT entry, as well as a dynamic
relocation for this entry. */
- if (htab->sgot == NULL)
+ if (htab->etab.sgot == NULL)
{
if (!elf32_hppa_create_dynamic_sections (htab->etab.dynobj, info))
return FALSE;
{
/* Make an entry in the .plt section for plabel references
that won't have a .plt entry for other reasons. */
- sec = htab->splt;
+ sec = htab->etab.splt;
eh->plt.offset = sec->size;
sec->size += PLT_ENTRY_SIZE;
}
&& eh->plt.refcount > 0)
{
/* Make an entry in the .plt section. */
- sec = htab->splt;
+ sec = htab->etab.splt;
eh->plt.offset = sec->size;
sec->size += PLT_ENTRY_SIZE;
/* We also need to make an entry in the .rela.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->etab.srelplt->size += sizeof (Elf32_External_Rela);
htab->need_plt_stub = 1;
}
return FALSE;
}
- sec = htab->sgot;
+ sec = htab->etab.sgot;
eh->got.offset = sec->size;
sec->size += GOT_ENTRY_SIZE;
/* R_PARISC_TLS_GD* needs two GOT entries */
|| (eh->dynindx != -1
&& !eh->forced_local)))
{
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->etab.srelgot->size += sizeof (Elf32_External_Rela);
if ((hh->tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
- htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
+ htab->etab.srelgot->size += 2 * sizeof (Elf32_External_Rela);
else if ((hh->tls_type & GOT_TLS_GD) == GOT_TLS_GD)
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->etab.srelgot->size += sizeof (Elf32_External_Rela);
}
}
else
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
local_tls_type = hppa_elf_local_got_tls_type (ibfd);
- sec = htab->sgot;
- srel = htab->srelgot;
+ sec = htab->etab.sgot;
+ srel = htab->etab.srelgot;
for (; local_got < end_local_got; ++local_got)
{
if (*local_got > 0)
}
else
{
- sec = htab->splt;
- srel = htab->srelplt;
+ sec = htab->etab.splt;
+ srel = htab->etab.srelplt;
for (; local_plt < end_local_plt; ++local_plt)
{
if (*local_plt > 0)
{
/* Allocate 2 got entries and 1 dynamic reloc for
R_PARISC_TLS_DTPMOD32 relocs. */
- htab->tls_ldm_got.offset = htab->sgot->size;
- htab->sgot->size += (GOT_ENTRY_SIZE * 2);
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->tls_ldm_got.offset = htab->etab.sgot->size;
+ htab->etab.sgot->size += (GOT_ENTRY_SIZE * 2);
+ htab->etab.srelgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tls_ldm_got.offset = -1;
if ((sec->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (sec == htab->splt)
+ if (sec == htab->etab.splt)
{
if (htab->need_plt_stub)
{
/* Make space for the plt stub at the end of the .plt
section. We want this stub right at the end, up
against the .got section. */
- int gotalign = bfd_section_alignment (dynobj, htab->sgot);
+ int gotalign = bfd_section_alignment (dynobj, htab->etab.sgot);
int pltalign = bfd_section_alignment (dynobj, sec);
bfd_size_type mask;
sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask;
}
}
- else if (sec == htab->sgot
+ else if (sec == htab->etab.sgot
|| sec == htab->sdynbss)
;
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, sec), ".rela"))
{
/* Remember whether there are any reloc sections other
than .rela.plt. */
- if (sec != htab->srelplt)
+ if (sec != htab->etab.srelplt)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
return FALSE;
}
- if (htab->srelplt->size != 0)
+ if (htab->etab.srelplt->size != 0)
{
if (!add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
object because the symbol index is zero. */
Elf_Internal_Rela outrel;
bfd_byte *loc;
- asection *sec = htab->srelgot;
+ asection *sec = htab->etab.srelgot;
outrel.r_offset = (off
- + htab->sgot->output_offset
- + htab->sgot->output_section->vma);
+ + htab->etab.sgot->output_offset
+ + htab->etab.sgot->output_section->vma);
outrel.r_info = ELF32_R_INFO (0, R_PARISC_DIR32);
outrel.r_addend = relocation;
loc = sec->contents;
}
else
bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
+ htab->etab.sgot->contents + off);
}
if (off >= (bfd_vma) -2)
/* Add the base of the GOT to the relocation value. */
relocation = (off
- + htab->sgot->output_offset
- + htab->sgot->output_section->vma);
+ + htab->etab.sgot->output_offset
+ + htab->etab.sgot->output_section->vma);
}
break;
PLT entry. */
Elf_Internal_Rela outrel;
bfd_byte *loc;
- asection *s = htab->srelplt;
+ asection *s = htab->etab.srelplt;
outrel.r_offset = (off
- + htab->splt->output_offset
- + htab->splt->output_section->vma);
+ + htab->etab.splt->output_offset
+ + htab->etab.splt->output_section->vma);
outrel.r_info = ELF32_R_INFO (0, R_PARISC_IPLT);
outrel.r_addend = relocation;
loc = s->contents;
{
bfd_put_32 (output_bfd,
relocation,
- htab->splt->contents + off);
+ htab->etab.splt->contents + off);
bfd_put_32 (output_bfd,
- elf_gp (htab->splt->output_section->owner),
- htab->splt->contents + off + 4);
+ elf_gp (htab->etab.splt->output_section->owner),
+ htab->etab.splt->contents + off + 4);
}
}
&& hh->eh.root.type != bfd_link_hash_undefined))
{
relocation = (off
- + htab->splt->output_offset
- + htab->splt->output_section->vma
+ + htab->etab.splt->output_offset
+ + htab->etab.splt->output_section->vma
+ 2);
}
plabel = 1;
bfd_byte *loc;
outrel.r_offset = (off
- + htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ + htab->etab.sgot->output_section->vma
+ + htab->etab.sgot->output_offset);
outrel.r_addend = 0;
outrel.r_info = ELF32_R_INFO (0, R_PARISC_TLS_DTPMOD32);
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+ loc = htab->etab.srelgot->contents;
+ loc += htab->etab.srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
htab->tls_ldm_got.offset |= 1;
/* Add the base of the GOT to the relocation value. */
relocation = (off
- + htab->sgot->output_offset
- + htab->sgot->output_section->vma);
+ + htab->etab.sgot->output_offset
+ + htab->etab.sgot->output_section->vma);
break;
}
|| hh->eh.root.type != bfd_link_hash_undefweak))
{
need_relocs = TRUE;
- loc = htab->srelgot->contents;
+ loc = htab->etab.srelgot->contents;
/* FIXME (CAO): Should this be reloc_count++ ? */
- loc += htab->srelgot->reloc_count * sizeof (Elf32_External_Rela);
+ loc += htab->etab.srelgot->reloc_count * sizeof (Elf32_External_Rela);
}
if (tls_type & GOT_TLS_GD)
if (need_relocs)
{
outrel.r_offset = (cur_off
- + htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ + htab->etab.sgot->output_section->vma
+ + htab->etab.sgot->output_offset);
outrel.r_info = ELF32_R_INFO (indx,R_PARISC_TLS_DTPMOD32);
outrel.r_addend = 0;
- bfd_put_32 (output_bfd, 0, htab->sgot->contents + cur_off);
+ bfd_put_32 (output_bfd, 0, htab->etab.sgot->contents + cur_off);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- htab->srelgot->reloc_count++;
+ htab->etab.srelgot->reloc_count++;
loc += sizeof (Elf32_External_Rela);
if (indx == 0)
bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
- htab->sgot->contents + cur_off + 4);
+ htab->etab.sgot->contents + cur_off + 4);
else
{
bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + cur_off + 4);
+ htab->etab.sgot->contents + cur_off + 4);
outrel.r_info = ELF32_R_INFO (indx, R_PARISC_TLS_DTPOFF32);
outrel.r_offset += 4;
bfd_elf32_swap_reloca_out (output_bfd, &outrel,loc);
- htab->srelgot->reloc_count++;
+ htab->etab.srelgot->reloc_count++;
loc += sizeof (Elf32_External_Rela);
}
}
symbol binding locally. Mark it as belonging
to module 1, the executable. */
bfd_put_32 (output_bfd, 1,
- htab->sgot->contents + cur_off);
+ htab->etab.sgot->contents + cur_off);
bfd_put_32 (output_bfd, relocation - dtpoff_base (info),
- htab->sgot->contents + cur_off + 4);
+ htab->etab.sgot->contents + cur_off + 4);
}
if (need_relocs)
{
outrel.r_offset = (cur_off
- + htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ + htab->etab.sgot->output_section->vma
+ + htab->etab.sgot->output_offset);
outrel.r_info = ELF32_R_INFO (indx, R_PARISC_TLS_TPREL32);
if (indx == 0)
outrel.r_addend = 0;
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- htab->srelgot->reloc_count++;
+ htab->etab.srelgot->reloc_count++;
loc += sizeof (Elf32_External_Rela);
}
else
bfd_put_32 (output_bfd, tpoff (info, relocation),
- htab->sgot->contents + cur_off);
+ htab->etab.sgot->contents + cur_off);
cur_off += 4;
}
/* Add the base of the GOT to the relocation value. */
relocation = (off
- + htab->sgot->output_offset
- + htab->sgot->output_section->vma);
+ + htab->etab.sgot->output_offset
+ + htab->etab.sgot->output_section->vma);
break;
}
/* Create a dynamic IPLT relocation for this entry. */
rela.r_offset = (eh->plt.offset
- + htab->splt->output_offset
- + htab->splt->output_section->vma);
+ + htab->etab.splt->output_offset
+ + htab->etab.splt->output_section->vma);
if (eh->dynindx != -1)
{
rela.r_info = ELF32_R_INFO (eh->dynindx, R_PARISC_IPLT);
rela.r_addend = value;
}
- loc = htab->srelplt->contents;
- loc += htab->srelplt->reloc_count++ * sizeof (Elf32_External_Rela);
- bfd_elf32_swap_reloca_out (htab->splt->output_section->owner, &rela, loc);
+ loc = htab->etab.srelplt->contents;
+ loc += htab->etab.srelplt->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (htab->etab.splt->output_section->owner, &rela, loc);
if (!eh->def_regular)
{
up. */
rela.r_offset = ((eh->got.offset &~ (bfd_vma) 1)
- + htab->sgot->output_offset
- + htab->sgot->output_section->vma);
+ + htab->etab.sgot->output_offset
+ + htab->etab.sgot->output_section->vma);
/* If this is a -Bsymbolic link and the symbol is defined
locally or was forced to be local because of a version file,
if ((eh->got.offset & 1) != 0)
abort ();
- bfd_put_32 (output_bfd, 0, htab->sgot->contents + (eh->got.offset & ~1));
+ bfd_put_32 (output_bfd, 0, htab->etab.sgot->contents + (eh->got.offset & ~1));
rela.r_info = ELF32_R_INFO (eh->dynindx, R_PARISC_DIR32);
rela.r_addend = 0;
}
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+ loc = htab->etab.srelgot->contents;
+ loc += htab->etab.srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
dynobj = htab->etab.dynobj;
- sgot = htab->sgot;
+ sgot = htab->etab.sgot;
/* A broken linker script might have discarded the dynamic sections.
Catch this here so that we do not seg-fault later on. */
if (sgot != NULL && bfd_is_abs_section (sgot->output_section))
break;
case DT_JMPREL:
- s = htab->srelplt;
+ s = htab->etab.srelplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_PLTRELSZ:
- s = htab->srelplt;
+ s = htab->etab.srelplt;
dyn.d_un.d_val = s->size;
break;
case DT_RELASZ:
/* Don't count procedure linkage table relocs in the
overall reloc count. */
- s = htab->srelplt;
+ s = htab->etab.srelplt;
if (s == NULL)
continue;
dyn.d_un.d_val -= s->size;
/* We may not be using the standard ELF linker script.
If .rela.plt is the first .rela section, we adjust
DT_RELA to not include it. */
- s = htab->srelplt;
+ s = htab->etab.srelplt;
if (s == NULL)
continue;
if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
->this_hdr.sh_entsize = GOT_ENTRY_SIZE;
}
- if (htab->splt != NULL && htab->splt->size != 0)
+ if (htab->etab.splt != NULL && htab->etab.splt->size != 0)
{
/* Set plt entry size to 0 instead of PLT_ENTRY_SIZE, since we add the
plt stubs and as such the section does not hold a table of fixed-size
entries. */
- elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize = 0;
+ elf_section_data (htab->etab.splt->output_section)->this_hdr.sh_entsize = 0;
if (htab->need_plt_stub)
{
/* Set up the .plt stub. */
- memcpy (htab->splt->contents
- + htab->splt->size - sizeof (plt_stub),
+ memcpy (htab->etab.splt->contents
+ + htab->etab.splt->size - sizeof (plt_stub),
plt_stub, sizeof (plt_stub));
- if ((htab->splt->output_offset
- + htab->splt->output_section->vma
- + htab->splt->size)
+ if ((htab->etab.splt->output_offset
+ + htab->etab.splt->output_section->vma
+ + htab->etab.splt->size)
!= (sgot->output_offset
+ sgot->output_section->vma))
{
{
asection *sdyn;
bfd *dynobj = elf_hash_table (info)->dynobj;
- asection *sgot = bfd_get_linker_section (dynobj, ".got");
+ asection *sgot = elf_hash_table (info)->sgot;
#ifdef DEBUG
fprintf (stderr, "i370_elf_finish_dynamic_sections called\n");
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char *name;
+ asection *s;
bfd_boolean size;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
switch (dyn.d_tag)
{
- case DT_PLTGOT: name = ".plt"; size = FALSE; break;
- case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break;
- case DT_JMPREL: name = ".rela.plt"; size = FALSE; break;
- default: name = NULL; size = FALSE; break;
+ case DT_PLTGOT:
+ s = elf_hash_table (info)->splt;
+ size = FALSE;
+ break;
+ case DT_PLTRELSZ:
+ s = elf_hash_table (info)->srelplt;
+ size = TRUE;
+ break;
+ case DT_JMPREL:
+ s = elf_hash_table (info)->srelplt;
+ size = FALSE;
+ break;
+ default:
+ continue;
}
- if (name != NULL)
+ if (s == NULL)
+ dyn.d_un.d_val = 0;
+ else
{
- asection *s;
-
- s = bfd_get_linker_section (dynobj, name);
- if (s == NULL)
- dyn.d_un.d_val = 0;
+ if (!size)
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
else
- {
- if (! size)
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- else
- dyn.d_un.d_val = s->size;
- }
- bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
+ dyn.d_un.d_val = s->size;
}
+ bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
}
}
struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
asection *sfixup32;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
== LM32_ELF_DATA ? ((struct elf_lm32_link_hash_table *) ((p)->hash)) : NULL)
#define lm32fdpic_got_section(info) \
- (lm32_elf_hash_table (info)->sgot)
+ (lm32_elf_hash_table (info)->root.sgot)
#define lm32fdpic_gotrel_section(info) \
- (lm32_elf_hash_table (info)->srelgot)
+ (lm32_elf_hash_table (info)->root.srelgot)
#define lm32fdpic_fixup32_section(info) \
(lm32_elf_hash_table (info)->sfixup32)
return fixup_offset;
}
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf_lm32_link_hash_table *htab;
- asection *s;
-
- /* This function may be called more than once. */
- s = bfd_get_linker_section (dynobj, ".got");
- if (s != NULL)
- return TRUE;
-
- htab = lm32_elf_hash_table (info);
- if (htab == NULL)
- return FALSE;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab->sgot = bfd_get_linker_section (dynobj, ".got");
- htab->sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
- abort ();
-
- return TRUE;
-}
-
/* Create .rofixup sections in DYNOBJ, and set up
shortcuts to them in our hash table. */
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
Elf_Internal_Rela *rel, *relend;
struct elf_lm32_link_hash_table *htab = lm32_elf_hash_table (info);
- bfd *dynobj;
bfd_vma *local_got_offsets;
asection *sgot;
if (htab == NULL)
return FALSE;
- dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
- sgot = htab->sgot;
+ sgot = htab->root.sgot;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
/* We need to generate a R_LM32_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_linker_section (dynobj,
- ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma
}
/* Some relocs require a global offset table. */
- if (htab->sgot == NULL)
+ if (htab->root.sgot == NULL)
{
switch (r_type)
{
case R_LM32_GOTOFF_LO16:
if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd;
- if (! create_got_section (dynobj, info))
+ if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE;
break;
}
(Normal ELF doesn't). */
if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd;
- if (! create_got_section (dynobj, info))
+ if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE;
/* Create .rofixup section */
if (htab->sfixup32 == NULL)
dynobj = htab->root.dynobj;
- sgot = htab->sgotplt;
+ sgot = htab->root.sgotplt;
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created)
break;
case DT_PLTGOT:
- s = htab->sgotplt;
+ s = htab->root.sgotplt;
goto get_vma;
case DT_JMPREL:
- s = htab->srelplt;
+ s = htab->root.srelplt;
get_vma:
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- if (htab->srelplt != NULL)
+ if (htab->root.srelplt != NULL)
{
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val -= s->size;
}
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
}
/* Fill in the first entry in the procedure linkage table. */
- splt = htab->splt;
+ splt = htab->root.splt;
if (splt && splt->size > 0)
{
if (bfd_link_pic (info))
it up. */
BFD_ASSERT (h->dynindx != -1);
- splt = htab->splt;
- sgot = htab->sgotplt;
- srela = htab->srelplt;
+ splt = htab->root.splt;
+ sgot = htab->root.sgotplt;
+ srela = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
/* Get the index in the procedure linkage table which
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = htab->sgot;
- srela = htab->srelgot;
+ sgot = htab->root.sgot;
+ srela = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
- asection *s = htab->splt;
+ asection *s = htab->root.splt;
/* If this is the first .plt entry, make room for the special
first entry. */
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- htab->sgotplt->size += 4;
+ htab->root.sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->root.srelplt->size += sizeof (Elf32_External_Rela);
}
else
{
return FALSE;
}
- s = htab->sgot;
+ s = htab->root.sgot;
h->got.offset = s->size;
s->size += 4;
dyn = htab->root.dynamic_sections_created;
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
else
h->got.offset = (bfd_vma) -1;
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
- s = htab->sgot;
- srel = htab->srelgot;
+ s = htab->root.sgot;
+ srel = htab->root.srelgot;
for (; local_got < end_local_got; ++local_got)
{
if (*local_got > 0)
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt
+ if (s == htab->root.splt
+ || s == htab->root.sgot
+ || s == htab->root.sgotplt
|| s == htab->sdynbss)
{
/* Strip this section if we don't need it; see the
}
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
return FALSE;
}
- if (htab->splt->size != 0)
+ if (htab->root.splt->size != 0)
{
if (! add_dynamic_entry (DT_PLTGOT, 0)
|| ! add_dynamic_entry (DT_PLTRELSZ, 0)
}
/* Size sections. */
- lm32fdpic_fixup32_section (info)->size = (r32_count + (htab->sgot->size / 4) - rgot_weak_count + 1) * 4;
+ lm32fdpic_fixup32_section (info)->size
+ = (r32_count + (htab->root.sgot->size / 4) - rgot_weak_count + 1) * 4;
if (lm32fdpic_fixup32_section (info)->size == 0)
lm32fdpic_fixup32_section (info)->flags |= SEC_EXCLUDE;
else
/* Make sure we have a GOT - For the case where we have a dynamic object
but none of the relocs in check_relocs */
- if (! create_got_section (abfd, info))
+ if (!_bfd_elf_create_got_section (abfd, info))
return FALSE;
if (IS_FDPIC (abfd) && (htab->sfixup32 == NULL))
{
pltflags |= SEC_READONLY;
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
- htab->splt = s;
+ htab->root.splt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
bed->default_use_rela_p
? ".rela.plt" : ".rel.plt",
flags | SEC_READONLY);
- htab->srelplt = s;
+ htab->root.srelplt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
- if (htab->sgot == NULL
- && ! create_got_section (abfd, info))
+ if (htab->root.sgot == NULL
+ && !_bfd_elf_create_got_section (abfd, info))
return FALSE;
if (bed->want_dynbss)
struct elf_link_hash_entry ** sym_hashes;
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
- bfd *dynobj;
asection *splt;
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
- dynobj = elf_hash_table (info)->dynobj;
- splt = NULL;
- if (dynobj != NULL)
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
for (rel = relocs; rel < relend; rel ++)
{
case R_M32C_16:
if (dynobj == NULL)
elf_hash_table (info)->dynobj = dynobj = abfd;
+ splt = elf_hash_table (info)->splt;
if (splt == NULL)
{
- splt = bfd_get_linker_section (dynobj, ".plt");
- if (splt == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY | SEC_CODE);
- splt = bfd_make_section_anyway_with_flags (dynobj, ".plt",
- flags);
- if (splt == NULL
- || ! bfd_set_section_alignment (dynobj, splt, 1))
- return FALSE;
- }
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY | SEC_CODE);
+ splt = bfd_make_section_anyway_with_flags (dynobj, ".plt",
+ flags);
+ elf_hash_table (info)->splt = splt;
+ if (splt == NULL
+ || ! bfd_set_section_alignment (dynobj, splt, 1))
+ return FALSE;
}
if (h != NULL)
m32c_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
- bfd *dynobj;
- asection *splt;
+ bfd *dynobj = elf_hash_table (info)->dynobj;
+ asection *splt = elf_hash_table (info)->splt;
/* As an extra sanity check, verify that all plt entries have
been filled in. */
- if ((dynobj = elf_hash_table (info)->dynobj) != NULL
- && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL)
+ if (dynobj != NULL && splt != NULL)
{
bfd_byte *contents = splt->contents;
unsigned int i, size = splt->size;
if (dynobj == NULL)
return TRUE;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL);
splt->contents = (bfd_byte *) bfd_zalloc (dynobj, splt->size);
struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
return &ret->root.root;
}
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf_m32r_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = m32r_elf_hash_table (info);
- if (htab == NULL)
- return FALSE;
-
- htab->sgot = bfd_get_linker_section (dynobj, ".got");
- htab->sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
- abort ();
-
- return TRUE;
-}
-
/* Create dynamic sections when linking against a dynamic object. */
static bfd_boolean
pltflags |= SEC_READONLY;
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
- htab->splt = s;
+ htab->root.splt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
bed->default_use_rela_p
? ".rela.plt" : ".rel.plt",
flags | SEC_READONLY);
- htab->srelplt = s;
+ htab->root.srelplt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
- if (htab->sgot == NULL
- && ! create_got_section (abfd, info))
+ if (htab->root.sgot == NULL
+ && !_bfd_elf_create_got_section (abfd, info))
return FALSE;
if (bed->want_dynbss)
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
- asection *s = htab->splt;
+ asection *s = htab->root.splt;
/* If this is the first .plt entry, make room for the special
first entry. */
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- htab->sgotplt->size += 4;
+ htab->root.sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->root.srelplt->size += sizeof (Elf32_External_Rela);
}
else
{
return FALSE;
}
- s = htab->sgot;
+ s = htab->root.sgot;
h->got.offset = s->size;
s->size += 4;
dyn = htab->root.dynamic_sections_created;
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
else
h->got.offset = (bfd_vma) -1;
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
- s = htab->sgot;
- srel = htab->srelgot;
+ s = htab->root.sgot;
+ srel = htab->root.srelgot;
for (; local_got < end_local_got; ++local_got)
{
if (*local_got > 0)
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt
+ if (s == htab->root.splt
+ || s == htab->root.sgot
+ || s == htab->root.sgotplt
|| s == htab->sdynbss)
{
/* Strip this section if we don't need it; see the
}
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
return FALSE;
}
- if (htab->splt->size != 0)
+ if (htab->root.splt->size != 0)
{
if (! add_dynamic_entry (DT_PLTGOT, 0)
|| ! add_dynamic_entry (DT_PLTRELSZ, 0)
/* Assume success. */
bfd_boolean ret = TRUE;
struct elf_m32r_link_hash_table *htab = m32r_elf_hash_table (info);
- bfd *dynobj;
bfd_vma *local_got_offsets;
asection *sgot, *splt, *sreloc;
bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section);
if (htab == NULL)
return FALSE;
- dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
- sgot = htab->sgot;
- splt = htab->splt;
+ sgot = htab->root.sgot;
+ splt = htab->root.splt;
sreloc = NULL;
rel = relocs;
/* We need to generate a R_M32R_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_linker_section (dynobj,
- ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma
BFD_ASSERT (h->dynindx != -1);
- splt = htab->splt;
- sgot = htab->sgotplt;
- srela = htab->srelplt;
+ splt = htab->root.splt;
+ sgot = htab->root.sgotplt;
+ srela = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
/* Get the index in the procedure linkage table which
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = htab->sgot;
- srela = htab->srelgot;
+ sgot = htab->root.sgot;
+ srela = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
dynobj = htab->root.dynobj;
- sgot = htab->sgotplt;
+ sgot = htab->root.sgotplt;
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created)
break;
case DT_PLTGOT:
- s = htab->sgotplt;
+ s = htab->root.sgotplt;
goto get_vma;
case DT_JMPREL:
- s = htab->srelplt;
+ s = htab->root.srelplt;
get_vma:
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- if (htab->srelplt != NULL)
+ if (htab->root.srelplt != NULL)
{
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val -= s->size;
}
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
}
/* Fill in the first entry in the procedure linkage table. */
- splt = htab->splt;
+ splt = htab->root.splt;
if (splt && splt->size > 0)
{
if (bfd_link_pic (info))
}
/* Some relocs require a global offset table. */
- if (htab->sgot == NULL)
+ if (htab->root.sgot == NULL)
{
switch (r_type)
{
case R_M32R_GOT24:
if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd;
- if (! create_got_section (dynobj, info))
+ if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE;
break;
{
asection *s;
- s = bfd_get_linker_section (elf_hash_table (info)->dynobj, ".got");
+ s = elf_hash_table (info)->sgot;
if (s != NULL)
s->size = arg_.offset;
else
BFD_ASSERT (arg_.slots_relas_diff <= arg_.n_slots);
arg_.n_slots -= arg_.slots_relas_diff;
- s = bfd_get_linker_section (elf_hash_table (info)->dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
if (s != NULL)
s->size = arg_.n_slots * sizeof (Elf32_External_Rela);
else
struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
- asection *sgot;
- asection *srelgot;
asection *sreloc;
struct elf_m68k_got *got;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
- sgot = NULL;
- srelgot = NULL;
sreloc = NULL;
got = NULL;
return FALSE;
}
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL
- && (h != NULL || bfd_link_pic (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
- srelgot = bfd_make_section_anyway_with_flags (dynobj,
- ".rela.got",
- flags);
- if (srelgot == NULL
- || !bfd_set_section_alignment (dynobj, srelgot, 2))
- return FALSE;
- }
- }
-
if (got == NULL)
{
struct elf_m68k_bfd2got_entry *bfd2got_entry;
asection *s;
htab = elf_m68k_hash_table (info);
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
/* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL
return FALSE;
}
- s = bfd_get_linker_section (dynobj, ".plt");
+ s = htab->root.splt;
BFD_ASSERT (s != NULL);
/* If this is the first .plt entry, make room for the special
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- s = bfd_get_linker_section (dynobj, ".got.plt");
+ s = htab->root.sgotplt;
BFD_ASSERT (s != NULL);
s->size += 4;
/* We also need to make an entry in the .rela.plt section. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = htab->root.srelplt;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf32_External_Rela);
not actually use these entries. Reset the size of .rela.got,
which will cause it to get stripped from the output file
below. */
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
if (s != NULL)
s->size = 0;
}
Elf_Internal_Sym *local_syms,
asection **local_sections)
{
- bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
asection *sgot;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
bfd_vma sgot_output_offset;
bfd_vma got_offset;
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
+ sgot = elf_hash_table (info)->sgot;
- if (sgot != NULL)
- sgot_output_offset = sgot->output_offset;
- else
- /* In this case we have a reference to
- _GLOBAL_OFFSET_TABLE_, but the GOT itself is
- empty.
- ??? Issue a warning? */
- sgot_output_offset = 0;
- }
- else
+ if (sgot != NULL)
sgot_output_offset = sgot->output_offset;
+ else
+ /* In this case we have a reference to
+ _GLOBAL_OFFSET_TABLE_, but the GOT itself is
+ empty.
+ ??? Issue a warning? */
+ sgot_output_offset = 0;
if (got == NULL)
{
bfd_vma *off_ptr;
bfd_vma off;
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
+ sgot = elf_hash_table (info)->sgot;
+ BFD_ASSERT (sgot != NULL);
if (got == NULL)
{
else if (bfd_link_pic (info)) /* && h == NULL */
/* Process local symbol during dynamic link. */
{
- if (srela == NULL)
- {
- srela = bfd_get_linker_section (dynobj, ".rela.got");
- BFD_ASSERT (srela != NULL);
- }
+ srela = elf_hash_table (info)->srelgot;
+ BFD_ASSERT (srela != NULL);
elf_m68k_init_got_entry_local_shared (info,
output_bfd,
break;
}
- if (splt == NULL)
- {
- splt = bfd_get_linker_section (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- }
+ splt = elf_hash_table (info)->splt;
+ BFD_ASSERT (splt != NULL);
relocation = (splt->output_section->vma
+ splt->output_offset
the procedure linkage table. */
BFD_ASSERT (h != NULL && h->plt.offset != (bfd_vma) -1);
- if (splt == NULL)
- {
- splt = bfd_get_linker_section (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- }
+ splt = elf_hash_table (info)->splt;
+ BFD_ASSERT (splt != NULL);
relocation = h->plt.offset;
unresolved_reloc = FALSE;
BFD_ASSERT (h->dynindx != -1);
plt_info = elf_m68k_hash_table (info)->plt_info;
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
- srela = bfd_get_linker_section (dynobj, ".rela.plt");
+ splt = elf_hash_table (info)->splt;
+ sgot = elf_hash_table (info)->sgotplt;
+ srela = elf_hash_table (info)->srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
/* Get the index in the procedure linkage table which
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srela = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srela = elf_hash_table (info)->srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
got_entry = elf_m68k_hash_entry (h)->glist;
dynobj = elf_hash_table (info)->dynobj;
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
+ sgot = elf_hash_table (info)->sgotplt;
BFD_ASSERT (sgot != NULL);
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char *name;
asection *s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
break;
case DT_PLTGOT:
- name = ".got.plt";
+ s = elf_hash_table (info)->sgotplt;
goto get_vma;
case DT_JMPREL:
- name = ".rela.plt";
+ s = elf_hash_table (info)->srelplt;
get_vma:
- s = bfd_get_linker_section (dynobj, name);
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s != NULL)
dyn.d_un.d_val -= s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
Elf_Internal_Sym **all_local_syms;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
if (hh->eh.forced_local)
break;
- if (hh->eh.plt.offset == (bfd_vma) -1 ||
- htab->splt == NULL)
+ if (hh->eh.plt.offset == (bfd_vma) -1 || htab->etab.splt == NULL)
{
/* We didn't make a PLT entry for this symbol. This
happens when statically linking PIC code, or when
break;
}
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
+ relocation = (htab->etab.splt->output_section->vma
+ + htab->etab.splt->output_offset
+ hh->eh.plt.offset);
break;
case R_METAG_HI16_GOTPC:
case R_METAG_LO16_GOTPC:
- BFD_ASSERT (htab->sgot != NULL);
+ BFD_ASSERT (htab->etab.sgot != NULL);
- relocation = (htab->sgot->output_section->vma +
- htab->sgot->output_offset);
+ relocation = (htab->etab.sgot->output_section->vma +
+ htab->etab.sgot->output_offset);
relocation += GOT_REG_OFFSET;
relocation -= (input_section->output_section->vma
+ input_section->output_offset
case R_METAG_HI16_GOTOFF:
case R_METAG_LO16_GOTOFF:
case R_METAG_GETSET_GOTOFF:
- BFD_ASSERT (htab->sgot != NULL);
+ BFD_ASSERT (htab->etab.sgot != NULL);
- relocation -= (htab->sgot->output_section->vma +
- htab->sgot->output_offset);
+ relocation -= (htab->etab.sgot->output_section->vma +
+ htab->etab.sgot->output_offset);
relocation -= GOT_REG_OFFSET;
break;
case R_METAG_GETSET_GOT:
object because the symbol index is zero. */
Elf_Internal_Rela outrel;
bfd_byte *loc;
- asection *s = htab->srelgot;
+ asection *s = htab->etab.srelgot;
outrel.r_offset = (off
- + htab->sgot->output_offset
- + htab->sgot->output_section->vma);
+ + htab->etab.sgot->output_offset
+ + htab->etab.sgot->output_section->vma);
outrel.r_info = ELF32_R_INFO (0, R_METAG_RELATIVE);
outrel.r_addend = relocation;
loc = s->contents;
}
else
bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
+ htab->etab.sgot->contents + off);
}
if (off >= (bfd_vma) -2)
int indx;
char tls_type;
- if (htab->sgot == NULL)
+ if (htab->etab.sgot == NULL)
abort();
indx = 0;
|| hh->eh.root.type != bfd_link_hash_undefweak))
{
need_relocs = TRUE;
- loc = htab->srelgot->contents;
+ loc = htab->etab.srelgot->contents;
/* FIXME (CAO): Should this be reloc_count++ ? */
- loc += htab->srelgot->reloc_count * sizeof (Elf32_External_Rela);
+ loc += htab->etab.srelgot->reloc_count * sizeof (Elf32_External_Rela);
}
if (tls_type & GOT_TLS_GD)
if (need_relocs)
{
outrel.r_offset = (cur_off
- + htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ + htab->etab.sgot->output_section->vma
+ + htab->etab.sgot->output_offset);
outrel.r_info = ELF32_R_INFO (indx, R_METAG_TLS_DTPMOD);
outrel.r_addend = 0;
- bfd_put_32 (output_bfd, 0, htab->sgot->contents + cur_off);
+ bfd_put_32 (output_bfd, 0, htab->etab.sgot->contents + cur_off);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- htab->srelgot->reloc_count++;
+ htab->etab.srelgot->reloc_count++;
loc += sizeof (Elf32_External_Rela);
if (indx == 0)
bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + cur_off + 4);
+ htab->etab.sgot->contents + cur_off + 4);
else
{
bfd_put_32 (output_bfd, 0,
- htab->sgot->contents + cur_off + 4);
+ htab->etab.sgot->contents + cur_off + 4);
outrel.r_info = ELF32_R_INFO (indx,
R_METAG_TLS_DTPOFF);
outrel.r_offset += 4;
bfd_elf32_swap_reloca_out (output_bfd,
&outrel, loc);
- htab->srelgot->reloc_count++;
+ htab->etab.srelgot->reloc_count++;
loc += sizeof (Elf32_External_Rela);
}
}
if (need_relocs)
{
outrel.r_offset = (cur_off
- + htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ + htab->etab.sgot->output_section->vma
+ + htab->etab.sgot->output_offset);
outrel.r_info = ELF32_R_INFO (indx, R_METAG_TLS_TPOFF);
if (indx == 0)
outrel.r_addend = 0;
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
- htab->srelgot->reloc_count++;
+ htab->etab.srelgot->reloc_count++;
loc += sizeof (Elf32_External_Rela);
}
else
bfd_put_32 (output_bfd, tpoff (info, relocation),
- htab->sgot->contents + cur_off);
+ htab->etab.sgot->contents + cur_off);
cur_off += 4;
}
{
bfd_vma off;
- if (htab->sgot == NULL)
+ if (htab->etab.sgot == NULL)
abort();
off = htab->tls_ldm_got.offset;
if (off & 1)
bfd_byte *loc;
outrel.r_offset = (off
- + htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ + htab->etab.sgot->output_section->vma
+ + htab->etab.sgot->output_offset);
outrel.r_addend = 0;
outrel.r_info = ELF32_R_INFO (0, R_METAG_TLS_DTPMOD);
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+ loc = htab->etab.srelgot->contents;
+ loc += htab->etab.srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
htab->tls_ldm_got.offset |= 1;
}
/* Don't try to create the .plt and .got twice. */
htab = metag_link_hash_table (info);
- if (htab->splt != NULL)
+ if (htab->etab.splt != NULL)
return TRUE;
/* Call the generic code to do most of the work. */
if (! _bfd_elf_create_dynamic_sections (abfd, info))
return FALSE;
- htab->sgot = bfd_get_linker_section (abfd, ".got");
- if (! htab->sgot)
- return FALSE;
-
- htab->sgotplt = bfd_make_section_with_flags (abfd, ".got.plt",
- (SEC_ALLOC | SEC_LOAD |
- SEC_HAS_CONTENTS |
- SEC_IN_MEMORY |
- SEC_LINKER_CREATED));
- if (htab->sgotplt == NULL
- || !bfd_set_section_alignment (abfd, htab->sgotplt, 2))
- return FALSE;
+ /* The header goes at the start of the dynamic .got section, which
+ is placed after the dynamic .got.plt section. ie. The header is
+ not necessarily at the start of the output .got section. */
+ htab->etab.sgot->size += 12;
- /* Define the symbol __GLOBAL_OFFSET_TABLE__ at the start of the .got
- section. We don't do this in the linker script because we don't want
- to define the symbol if we are not creating a global offset table. */
+ /* Define the symbol __GLOBAL_OFFSET_TABLE__ on the header. */
bh = NULL;
if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "__GLOBAL_OFFSET_TABLE__", BSF_GLOBAL, htab->sgot,
+ (info, abfd, "__GLOBAL_OFFSET_TABLE__", BSF_GLOBAL, htab->etab.sgot,
(bfd_vma) 0, NULL, FALSE, bed->collect, &bh)))
return FALSE;
eh = (struct elf_link_hash_entry *) bh;
&& ! bfd_elf_link_record_dynamic_symbol (info, eh))
return FALSE;
- elf_hash_table (info)->hgot = eh;
-
- htab->splt = bfd_get_linker_section (abfd, ".plt");
- htab->srelplt = bfd_get_linker_section (abfd, ".rela.plt");
-
- htab->srelgot = bfd_get_linker_section (abfd, ".rela.got");
+ htab->etab.hgot = eh;
htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
}
/* Some relocs require a global offset table. */
- if (htab->sgot == NULL)
+ if (htab->etab.sgot == NULL)
{
switch (r_type)
{
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), eh))
{
- asection *s = htab->splt;
+ asection *s = htab->etab.splt;
/* If this is the first .plt entry, make room for the special
first entry. */
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- htab->sgotplt->size += 4;
+ htab->etab.sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->etab.srelplt->size += sizeof (Elf32_External_Rela);
}
else
{
return FALSE;
}
- s = htab->sgot;
+ s = htab->etab.sgot;
eh->got.offset = s->size;
s->size += 4;
R_METAG_TLS_GD needs one if local symbol and two if global. */
if ((tls_type == GOT_TLS_GD && eh->dynindx == -1)
|| (tls_type == GOT_TLS_IE && dyn))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->etab.srelgot->size += sizeof (Elf32_External_Rela);
else if (tls_type == GOT_TLS_GD)
- htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
+ htab->etab.srelgot->size += 2 * sizeof (Elf32_External_Rela);
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
bfd_link_pic (info),
eh))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->etab.srelgot->size += sizeof (Elf32_External_Rela);
}
else
eh->got.offset = (bfd_vma) -1;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
local_tls_type = metag_elf_local_got_tls_type (ibfd);
- s = htab->sgot;
- srel = htab->srelgot;
+ s = htab->etab.sgot;
+ srel = htab->etab.srelgot;
for (; local_got < end_local_got; ++local_got)
{
if (*local_got > 0)
{
/* Allocate 2 got entries and 1 dynamic reloc for R_METAG_TLS_LDM
reloc. */
- htab->tls_ldm_got.offset = htab->sgot->size;
- htab->sgot->size += 8;
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->tls_ldm_got.offset = htab->etab.sgot->size;
+ htab->etab.sgot->size += 8;
+ htab->etab.srelgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tls_ldm_got.offset = -1;
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt
+ if (s == htab->etab.splt
+ || s == htab->etab.sgot
+ || s == htab->etab.sgotplt
|| s == htab->sdynbss)
{
/* Strip this section if we don't need it; see the
}
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->etab.srelplt)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
return FALSE;
}
- if (htab->srelplt->size != 0)
+ if (htab->etab.srelplt->size != 0)
{
if (!add_dynamic_entry (DT_PLTRELSZ, 0)
|| !add_dynamic_entry (DT_PLTREL, DT_RELA)
BFD_ASSERT (eh->dynindx != -1);
- splt = htab->splt;
- sgot = htab->sgotplt;
- srela = htab->srelplt;
+ splt = htab->etab.splt;
+ sgot = htab->etab.sgotplt;
+ srela = htab->etab.srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
/* Get the index in the procedure linkage table which
+ got_offset);
rel.r_info = ELF32_R_INFO (eh->dynindx, R_METAG_JMP_SLOT);
rel.r_addend = 0;
- loc = htab->srelplt->contents;
+ loc = htab->etab.srelplt->contents;
loc += plt_index * sizeof(Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
up. */
rel.r_offset = ((eh->got.offset &~ (bfd_vma) 1)
- + htab->sgot->output_offset
- + htab->sgot->output_section->vma);
+ + htab->etab.sgot->output_offset
+ + htab->etab.sgot->output_section->vma);
/* If this is a -Bsymbolic link and the symbol is defined
locally or was forced to be local because of a version file,
{
if ((eh->got.offset & 1) != 0)
abort ();
- bfd_put_32 (output_bfd, 0, htab->sgot->contents + eh->got.offset);
+ bfd_put_32 (output_bfd, 0, htab->etab.sgot->contents + eh->got.offset);
rel.r_info = ELF32_R_INFO (eh->dynindx, R_METAG_GLOB_DAT);
rel.r_addend = 0;
}
- loc = htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+ loc = htab->etab.srelgot->contents;
+ loc += htab->etab.srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
}
continue;
case DT_PLTGOT:
- s = htab->sgot;
+ s = htab->etab.sgot;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_JMPREL:
- s = htab->srelplt;
+ s = htab->etab.srelplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = htab->srelplt;
+ s = htab->etab.srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_RELASZ:
/* Don't count procedure linkage table relocs in the
overall reloc count. */
- if (htab->srelplt) {
- s = htab->srelplt;
+ if (htab->etab.srelplt) {
+ s = htab->etab.srelplt;
dyn.d_un.d_val -= s->size;
}
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
/* We may not be using the standard ELF linker script.
If .rela.plt is the first .rela section, we adjust
DT_RELA to not include it. */
- if (htab->srelplt) {
- s = htab->srelplt;
+ if (htab->etab.srelplt) {
+ s = htab->etab.srelplt;
if (dyn.d_un.d_ptr == s->output_section->vma + s->output_offset)
dyn.d_un.d_ptr += s->size;
}
}
/* Fill in the first entry in the procedure linkage table. */
- splt = htab->splt;
+ splt = htab->etab.splt;
if (splt && splt->size > 0)
{
unsigned long addr;
/* addr = .got + 4 */
- addr = htab->sgot->output_section->vma +
- htab->sgot->output_offset + 4;
+ addr = (htab->etab.sgot->output_section->vma
+ + htab->etab.sgot->output_offset + 4);
if (bfd_link_pic (info))
{
addr -= splt->output_section->vma + splt->output_offset;
}
}
- if (htab->sgot != NULL && htab->sgot->size != 0)
+ if (htab->etab.sgot != NULL && htab->etab.sgot->size != 0)
{
/* Fill in the first entry in the global offset table.
We use it to point to our dynamic section, if we have one. */
bfd_put_32 (output_bfd,
sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0,
- htab->sgot->contents);
+ htab->etab.sgot->contents);
/* The second entry is reserved for use by the dynamic linker. */
- memset (htab->sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE);
+ memset (htab->etab.sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE);
/* Set .got entry size. */
- elf_section_data (htab->sgot->output_section)
+ elf_section_data (htab->etab.sgot->output_section)
->this_hdr.sh_entsize = GOT_ENTRY_SIZE;
}
&& hh->eh.dynindx != -1
&& r_type == (unsigned int) R_METAG_RELBRANCH_PLT)
{
- sym_sec = htab->splt;
+ sym_sec = htab->etab.splt;
sym_value = hh->eh.plt.offset;
}
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
-#define elf_backend_got_header_size 12
-#define elf_backend_rela_normal 1
+#define elf_backend_rela_normal 1
+#define elf_backend_want_got_plt 1
#define elf_backend_want_got_sym 0
#define elf_backend_want_plt_sym 0
#define elf_backend_plt_readonly 1
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
break; /* Do nothing. */
case (int) R_MICROBLAZE_GOTPC_64:
- relocation = htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset;
+ relocation = (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset);
relocation -= (input_section->output_section->vma
+ input_section->output_offset
+ offset + INST_WORD_SIZE);
case (int) R_MICROBLAZE_PLT_64:
{
bfd_vma immediate;
- if (htab->splt != NULL && h != NULL
+ if (htab->elf.splt != NULL && h != NULL
&& h->plt.offset != (bfd_vma) -1)
{
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
+ relocation = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ h->plt.offset);
unresolved_reloc = FALSE;
immediate = relocation - (input_section->output_section->vma
bfd_vma static_value;
bfd_boolean need_relocs = FALSE;
- if (htab->sgot == NULL)
+ if (htab->elf.sgot == NULL)
abort ();
indx = 0;
offp = &htab->tlsld_got.offset;
else if (h != NULL)
{
- if (htab->sgotplt != NULL && h->got.offset != (bfd_vma) -1)
- offp = &h->got.offset;
+ if (htab->elf.sgotplt != NULL
+ && h->got.offset != (bfd_vma) -1)
+ offp = &h->got.offset;
else
- abort ();
+ abort ();
}
else
{
{
bfd_vma got_offset;
- got_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
+ got_offset = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset
+ off);
/* Process module-id */
if (IS_TLS_LD(tls_type))
{
if (! bfd_link_pic (info))
- {
- bfd_put_32 (output_bfd, 1, htab->sgot->contents + off);
- }
+ bfd_put_32 (output_bfd, 1,
+ htab->elf.sgot->contents + off);
else
- {
- microblaze_elf_output_dynamic_relocation (output_bfd,
- htab->srelgot, htab->srelgot->reloc_count++,
- /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32,
- got_offset, 0);
- }
+ microblaze_elf_output_dynamic_relocation
+ (output_bfd,
+ htab->elf.srelgot,
+ htab->elf.srelgot->reloc_count++,
+ /* symindex= */ 0, R_MICROBLAZE_TLSDTPMOD32,
+ got_offset, 0);
}
else if (IS_TLS_GD(tls_type))
{
if (! need_relocs)
- {
- bfd_put_32 (output_bfd, 1, htab->sgot->contents + off);
- }
+ bfd_put_32 (output_bfd, 1,
+ htab->elf.sgot->contents + off);
else
- {
- microblaze_elf_output_dynamic_relocation (output_bfd,
- htab->srelgot,
- htab->srelgot->reloc_count++,
- /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32,
- got_offset, indx ? 0 : static_value);
- }
+ microblaze_elf_output_dynamic_relocation
+ (output_bfd,
+ htab->elf.srelgot,
+ htab->elf.srelgot->reloc_count++,
+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPMOD32,
+ got_offset, indx ? 0 : static_value);
}
/* Process Offset */
- if (htab->srelgot == NULL)
+ if (htab->elf.srelgot == NULL)
abort ();
- got_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
+ got_offset = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset
+ off2);
if (IS_TLS_LD(tls_type))
{
/* For LD, offset should be 0 */
*offp |= 1;
- bfd_put_32 (output_bfd, 0, htab->sgot->contents + off2);
+ bfd_put_32 (output_bfd, 0,
+ htab->elf.sgot->contents + off2);
}
else if (IS_TLS_GD(tls_type))
{
*offp |= 1;
static_value -= dtprel_base(info);
if (need_relocs)
- {
- microblaze_elf_output_dynamic_relocation (output_bfd,
- htab->srelgot, htab->srelgot->reloc_count++,
- /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
- got_offset, indx ? 0 : static_value);
- }
+ microblaze_elf_output_dynamic_relocation
+ (output_bfd,
+ htab->elf.srelgot,
+ htab->elf.srelgot->reloc_count++,
+ /* symindex= */ indx, R_MICROBLAZE_TLSDTPREL32,
+ got_offset, indx ? 0 : static_value);
else
- {
- bfd_put_32 (output_bfd, static_value,
- htab->sgot->contents + off2);
- }
+ bfd_put_32 (output_bfd, static_value,
+ htab->elf.sgot->contents + off2);
}
else
{
- bfd_put_32 (output_bfd, static_value,
- htab->sgot->contents + off2);
+ bfd_put_32 (output_bfd, static_value,
+ htab->elf.sgot->contents + off2);
- /* Relocs for dyn symbols generated by
- finish_dynamic_symbols */
- if (bfd_link_pic (info) && h == NULL)
- {
- *offp |= 1;
- microblaze_elf_output_dynamic_relocation (output_bfd,
- htab->srelgot, htab->srelgot->reloc_count++,
- /* symindex= */ indx, R_MICROBLAZE_REL,
- got_offset, static_value);
- }
+ /* Relocs for dyn symbols generated by
+ finish_dynamic_symbols */
+ if (bfd_link_pic (info) && h == NULL)
+ {
+ *offp |= 1;
+ microblaze_elf_output_dynamic_relocation
+ (output_bfd,
+ htab->elf.srelgot,
+ htab->elf.srelgot->reloc_count++,
+ /* symindex= */ indx, R_MICROBLAZE_REL,
+ got_offset, static_value);
+ }
}
}
/* 4. Fixup Relocation with GOT offset value
Compute relative address of GOT entry for applying
the current relocation */
- relocation = htab->sgot->output_section->vma
- + htab->sgot->output_offset
+ relocation = htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset
+ off
- - htab->sgotplt->output_section->vma
- - htab->sgotplt->output_offset;
+ - htab->elf.sgotplt->output_section->vma
+ - htab->elf.sgotplt->output_offset;
/* Apply Current Relocation */
bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
bfd_vma immediate;
unsigned short lo, high;
relocation += addend;
- relocation -= htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset;
+ relocation -= (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset);
/* Write this value into correct location. */
immediate = relocation;
lo = immediate & 0x0000ffff;
high = (immediate >> 16) & 0x0000ffff;
bfd_put_16 (input_bfd, high, contents + offset + endian);
- bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + endian);
+ bfd_put_16 (input_bfd, lo,
+ contents + offset + INST_WORD_SIZE + endian);
break;
}
case (int) R_MICROBLAZE_GOTOFF_32:
{
relocation += addend;
- relocation -= htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset;
+ relocation -= (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset);
/* Write this value into correct location. */
bfd_put_32 (input_bfd, relocation, contents + offset);
break;
#define PLT_ENTRY_WORD_2 0x98186000 /* "brad r12". */
#define PLT_ENTRY_WORD_3 0x80000000 /* "nop". */
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf32_mb_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
- htab = elf32_mb_hash_table (info);
- if (htab == NULL)
- return FALSE;
-
- htab->sgot = bfd_get_linker_section (dynobj, ".got");
- htab->sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- if (!htab->sgot || !htab->sgotplt)
- return FALSE;
-
- if ((htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got")) == NULL)
- htab->srelgot = bfd_make_section_anyway (dynobj, ".rela.got");
- if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot, SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY)
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return FALSE;
- return TRUE;
-}
-
static bfd_boolean
update_local_sym_info (bfd *abfd,
Elf_Internal_Shdr *symtab_hdr,
sec->has_tls_reloc = 1;
/* Fall through. */
case R_MICROBLAZE_GOT_64:
- if (htab->sgot == NULL)
+ if (htab->elf.sgot == NULL)
{
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
return FALSE;
}
if (h != NULL)
if (htab == NULL)
return FALSE;
- if (!htab->sgot && !create_got_section (dynobj, 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->splt = bfd_get_linker_section (dynobj, ".plt");
- htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
- if (!htab->splt || !htab->srelplt || !htab->sdynbss
+ if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
- asection *s = htab->splt;
+ asection *s = htab->elf.splt;
/* The first entry in .plt is reserved. */
if (s->size == 0)
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- htab->sgotplt->size += 4;
+ htab->elf.sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->elf.srelplt->size += sizeof (Elf32_External_Rela);
}
else
{
}
else
{
- s = htab->sgot;
+ s = htab->elf.sgot;
h->got.offset = s->size;
s->size += need;
- htab->srelgot->size += need * (sizeof (Elf32_External_Rela) / 4);
+ htab->elf.srelgot->size += need * (sizeof (Elf32_External_Rela) / 4);
}
}
else
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
lgot_masks = (unsigned char *) end_local_got;
- s = htab->sgot;
- srel = htab->srelgot;
+ s = htab->elf.sgot;
+ srel = htab->elf.srelgot;
for (; local_got < end_local_got; ++local_got, ++lgot_masks)
{
if (htab->tlsld_got.refcount > 0)
{
- htab->tlsld_got.offset = htab->sgot->size;
- htab->sgot->size += 8;
+ htab->tlsld_got.offset = htab->elf.sgot->size;
+ htab->elf.sgot->size += 8;
if (bfd_link_pic (info))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->elf.srelgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tlsld_got.offset = (bfd_vma) -1;
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Make space for the trailing nop in .plt. */
- if (htab->splt->size > 0)
- htab->splt->size += 4;
+ if (htab->elf.splt->size > 0)
+ htab->elf.splt->size += 4;
}
/* The check_relocs and adjust_dynamic_symbol entry points have
s->reloc_count = 0;
}
}
- else if (s != htab->splt && s != htab->sgot && s != htab->sgotplt)
+ else if (s != htab->elf.splt
+ && s != htab->elf.sgot
+ && s != htab->elf.sgotplt)
{
/* It's not one of our sections, so don't allocate space. */
continue;
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
return FALSE;
- if (htab->splt->size != 0)
+ if (htab->elf.splt->size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
it up. */
BFD_ASSERT (h->dynindx != -1);
- splt = htab->splt;
- srela = htab->srelplt;
- sgotplt = htab->sgotplt;
+ splt = htab->elf.splt;
+ srela = htab->elf.srelplt;
+ sgotplt = htab->elf.sgotplt;
BFD_ASSERT (splt != NULL && srela != NULL && sgotplt != NULL);
plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; /* first entry reserved. */
/* For non-PIC objects we need absolute address of the GOT entry. */
if (!bfd_link_pic (info))
- got_addr += htab->sgotplt->output_section->vma + sgotplt->output_offset;
+ got_addr += sgotplt->output_section->vma + sgotplt->output_offset;
/* Fill in the entry in the procedure linkage table. */
bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff),
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = htab->sgot;
- srela = htab->srelgot;
+ sgot = htab->elf.sgot;
+ srela = htab->elf.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
offset = (sgot->output_section->vma + sgot->output_offset
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = htab->elf.splt;
BFD_ASSERT (splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
/* Set the first entry in the global offset table to the address of
the dynamic section. */
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
+ sgot = htab->elf.sgotplt;
if (sgot && sgot->size > 0)
{
if (sdyn == NULL)
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
}
- if (htab->sgot && htab->sgot->size > 0)
- elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4;
+ if (htab->elf.sgot && htab->elf.sgot->size > 0)
+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
return TRUE;
}
return NULL;
}
- ret->sgot = NULL;
- ret->sgotplt = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->sym_ld_script = NULL;
- ret->ex9_export_file = NULL;
- ret->ex9_import_file = NULL;
-
return &ret->root.root;
}
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf_nds32_link_hash_table *htab;
-
- if (!_bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = nds32_elf_hash_table (info);
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- if (!htab->sgot || !htab->sgotplt)
- abort ();
-
- /* _bfd_elf_create_got_section will create it for us. */
- htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- if (htab->srelgot == NULL
- || !bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
- || !bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return FALSE;
-
- return TRUE;
-}
-
/* Create dynamic sections when linking against a dynamic object. */
static bfd_boolean
pltflags |= SEC_READONLY;
s = bfd_make_section (abfd, ".plt");
- htab->splt = s;
+ htab->root.splt = s;
if (s == NULL
|| !bfd_set_section_flags (abfd, s, pltflags)
|| !bfd_set_section_alignment (abfd, s, bed->plt_alignment))
s = bfd_make_section (abfd,
bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
- htab->srelplt = s;
+ htab->root.srelplt = s;
if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| !bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
- if (htab->sgot == NULL && !create_got_section (abfd, info))
+ if (htab->root.sgot == NULL && !_bfd_elf_create_got_section (abfd, info))
return FALSE;
{
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
- asection *s = htab->splt;
+ asection *s = htab->root.splt;
/* If this is the first .plt entry, make room for the special
first entry. */
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- htab->sgotplt->size += 4;
+ htab->root.sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->root.srelplt->size += sizeof (Elf32_External_Rela);
}
else
{
return FALSE;
}
- s = htab->sgot;
+ s = htab->root.sgot;
h->got.offset = s->size;
if (tls_type == GOT_UNKNOWN)
dyn = htab->root.dynamic_sections_created;
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
else
h->got.offset = (bfd_vma) - 1;
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
- s = htab->sgot;
- srel = htab->srelgot;
+ s = htab->root.sgot;
+ srel = htab->root.srelgot;
for (; local_got < end_local_got; ++local_got)
{
if (*local_got > 0)
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->splt)
+ if (s == htab->root.splt)
{
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (s == htab->sgot)
+ else if (s == htab->root.sgot)
{
got_size += s->size;
}
- else if (s == htab->sgotplt)
+ else if (s == htab->root.sgotplt)
{
got_size += s->size;
}
else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
{
- if (s->size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
return FALSE;
}
- if (htab->splt->size != 0)
+ if (htab->root.splt->size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
- sgot = htab->sgot;
- splt = htab->splt;
+ sgot = htab->root.sgot;
+ splt = htab->root.splt;
sreloc = NULL;
rel = relocs;
/* We need to generate a R_NDS32_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (elf_gp (output_bfd)
/* We need to generate a R_NDS32_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (elf_gp (output_bfd)
else
{
bfd_boolean need_relocs = FALSE;
- srelgot = htab->srelgot;
+ srelgot = htab->root.srelgot;
if ((bfd_link_pic (info) || indx != 0)
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
BFD_ASSERT (h->dynindx != -1);
- splt = htab->splt;
- sgot = htab->sgotplt;
- srela = htab->srelplt;
+ splt = htab->root.splt;
+ sgot = htab->root.sgotplt;
+ srela = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
/* Get the index in the procedure linkage table which
/* This symbol has an entry in the global offset table.
Set it up. */
- sgot = htab->sgot;
- srela = htab->srelgot;
+ sgot = htab->root.sgot;
+ srela = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
htab = nds32_elf_hash_table (info);
dynobj = htab->root.dynobj;
- sgot = htab->sgotplt;
+ sgot = htab->root.sgotplt;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created)
break;
case DT_PLTGOT:
- s = htab->sgotplt;
+ s = htab->root.sgotplt;
goto get_vma;
case DT_JMPREL:
- s = htab->srelplt;
+ s = htab->root.srelplt;
get_vma:
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- if (htab->srelplt != NULL)
+ if (htab->root.srelplt != NULL)
{
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val -= s->size;
}
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
}
/* Fill in the first entry in the procedure linkage table. */
- splt = htab->splt;
+ splt = htab->root.splt;
if (splt && splt->size > 0)
{
if (bfd_link_pic (info))
/* Some relocs require a global offset table. We create
got section here, since these relocation need got section
and it is not created yet. */
- if (htab->sgot == NULL)
+ if (htab->root.sgot == NULL)
{
switch (r_type)
{
case R_NDS32_TLS_IE_LO12S2:
if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd;
- if (!create_got_section (dynobj, info))
+ if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE;
break;
h = elf_sym_hashes (abfd)[indx];
BFD_ASSERT (h != NULL);
htab = nds32_elf_hash_table (link_info);
- splt = htab->splt;
+ splt = htab->root.splt;
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
if (symndx >= 0)
{
BFD_ASSERT (h != NULL);
- return htab->sgot->output_section->vma + htab->sgot->output_offset
- + h->got.offset;
+ return (htab->root.sgot->output_section->vma
+ + htab->root.sgot->output_offset
+ + h->got.offset);
}
else
{
local_got_offsets = elf_local_got_offsets (abfd);
BFD_ASSERT (local_got_offsets != NULL);
- return htab->sgot->output_section->vma + htab->sgot->output_offset
- + local_got_offsets[ELF32_R_SYM (irel->r_info)];
+ return (htab->root.sgot->output_section->vma
+ + htab->root.sgot->output_offset
+ + local_got_offsets[ELF32_R_SYM (irel->r_info)]);
}
/* The _GLOBAL_OFFSET_TABLE_ may be undefweak(or should be?). */
struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
sreloc = elf_section_data (input_section)->sreloc;
- sgot = htab->sgot;
+ sgot = htab->root.sgot;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
{
case R_OR1K_PLT26:
{
- if (htab->splt != NULL && h != NULL
+ if (htab->root.splt != NULL && h != NULL
&& h->plt.offset != (bfd_vma) -1)
{
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
+ relocation = (htab->root.splt->output_section->vma
+ + htab->root.splt->output_offset
+ h->plt.offset);
}
break;
/* We need to generate a R_OR1K_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma
return TRUE;
}
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf_or1k_link_hash_table *htab;
- asection *s;
-
- /* This function may be called more than once. */
- s = bfd_get_section_by_name (dynobj, ".got");
- if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0)
- return TRUE;
-
- htab = or1k_elf_hash_table (info);
- if (htab == NULL)
- return FALSE;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
- htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-
- if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
- abort ();
-
- if (! bfd_set_section_flags (dynobj, htab->srelgot, SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY)
- || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
- return FALSE;
-
- return TRUE;
-}
-
/* Look through the relocs for a section during the first phase. */
static bfd_boolean
case R_OR1K_TLS_GD_LO16:
case R_OR1K_TLS_IE_HI16:
case R_OR1K_TLS_IE_LO16:
- if (htab->sgot == NULL)
+ if (htab->root.sgot == NULL)
{
if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd;
- if (! create_got_section (dynobj, info))
+ if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE;
}
dynobj = htab->root.dynobj;
- sgot = htab->sgotplt;
+ sgot = htab->root.sgotplt;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created)
continue;
case DT_PLTGOT:
- s = htab->sgotplt;
+ s = htab->root.sgotplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_JMPREL:
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_PLTRELSZ:
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val = s->size;
break;
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- if (htab->srelplt != NULL)
+ if (htab->root.srelplt != NULL)
{
- s = htab->srelplt;
+ s = htab->root.srelplt;
dyn.d_un.d_val -= s->size;
}
break;
/* Fill in the first entry in the procedure linkage table. */
- splt = htab->splt;
+ splt = htab->root.splt;
if (splt && splt->size > 0)
{
if (bfd_link_pic (info))
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
}
- if (htab->sgot && htab->sgot->size > 0)
- elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4;
+ if (htab->root.sgot && htab->root.sgot->size > 0)
+ elf_section_data (htab->root.sgot->output_section)->this_hdr.sh_entsize = 4;
return TRUE;
}
it up. */
BFD_ASSERT (h->dynindx != -1);
- splt = htab->splt;
- sgot = htab->sgotplt;
- srela = htab->srelplt;
+ splt = htab->root.splt;
+ sgot = htab->root.sgotplt;
+ srela = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
/* Get the index in the procedure linkage table which
/* Fill in the entry in the procedure linkage table. */
if (! bfd_link_pic (info))
{
- got_addr += htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset;
+ got_addr += htab->root.sgotplt->output_section->vma
+ + htab->root.sgotplt->output_offset;
bfd_put_32 (output_bfd, PLT_ENTRY_WORD0 | ((got_addr >> 16) & 0xffff),
splt->contents + h->plt.offset);
bfd_put_32 (output_bfd, PLT_ENTRY_WORD1 | (got_addr & 0xffff),
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = htab->sgot;
- srela = htab->srelgot;
+ sgot = htab->root.sgot;
+ srela = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
- asection *s = htab->splt;
+ asection *s = htab->root.splt;
/* If this is the first .plt entry, make room for the special
first entry. */
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- htab->sgotplt->size += 4;
+ htab->root.sgotplt->size += 4;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->root.srelplt->size += sizeof (Elf32_External_Rela);
}
else
{
return FALSE;
}
- s = htab->sgot;
+ s = htab->root.sgot;
h->got.offset = s->size;
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
{
if (tls_type == TLS_GD)
- htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += 2 * sizeof (Elf32_External_Rela);
else
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
}
else
symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
locsymcount = symtab_hdr->sh_info;
end_local_got = local_got + locsymcount;
- s = htab->sgot;
- srel = htab->srelgot;
+ s = htab->root.sgot;
+ srel = htab->root.srelgot;
local_tls_type = (unsigned char *) elf_or1k_local_tls_type (ibfd);
for (; local_got < end_local_got; ++local_got)
{
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt
+ if (s == htab->root.splt
+ || s == htab->root.sgot
+ || s == htab->root.sgotplt
|| s == htab->sdynbss)
{
/* Strip this section if we don't need it; see the
}
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->size != 0 && s != htab->srelplt)
+ if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
return FALSE;
}
- if (htab->splt->size != 0)
+ if (htab->root.splt->size != 0)
{
if (! add_dynamic_entry (DT_PLTGOT, 0)
|| ! add_dynamic_entry (DT_PLTRELSZ, 0)
if (htab == NULL)
return FALSE;
- if (!htab->sgot && !create_got_section (dynobj, info))
+ if (!htab->root.sgot && !_bfd_elf_create_got_section (dynobj, info))
return FALSE;
if (!_bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
- htab->splt = bfd_get_section_by_name (dynobj, ".plt");
- htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
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->splt || !htab->srelplt || !htab->sdynbss
+ if (!htab->root.splt || !htab->root.srelplt || !htab->sdynbss
|| (!bfd_link_pic (info) && !htab->srelbss))
abort ();
struct ppc_elf_params *params;
/* Short-cuts to get to dynamic linker sections. */
- asection *got;
- asection *relgot;
asection *glink;
- asection *plt;
- asection *relplt;
- asection *iplt;
- asection *reliplt;
asection *dynbss;
asection *relbss;
asection *dynsbss;
/* The (unloaded but important) .rela.plt.unloaded on VxWorks. */
asection *srelplt2;
- /* The .got.plt section (VxWorks only)*/
- asection *sgotplt;
-
/* Shortcut to __tls_get_addr. */
struct elf_link_hash_entry *tls_get_addr;
ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
{
struct ppc_elf_link_hash_table *htab;
- asection *s;
- flagword flags;
if (!_bfd_elf_create_got_section (abfd, info))
return FALSE;
htab = ppc_elf_hash_table (info);
- htab->got = s = bfd_get_linker_section (abfd, ".got");
- if (s == NULL)
- abort ();
-
- if (htab->is_vxworks)
- {
- htab->sgotplt = bfd_get_linker_section (abfd, ".got.plt");
- if (!htab->sgotplt)
- abort ();
- }
- else
+ if (!htab->is_vxworks)
{
/* The powerpc .got has a blrl instruction in it. Mark it
executable. */
- flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED);
- if (!bfd_set_section_flags (abfd, s, flags))
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+ if (!bfd_set_section_flags (abfd, htab->elf.sgot, flags))
return FALSE;
}
- htab->relgot = bfd_get_linker_section (abfd, ".rela.got");
- if (!htab->relgot)
- abort ();
-
return TRUE;
}
flags = SEC_ALLOC | SEC_LINKER_CREATED;
s = bfd_make_section_anyway_with_flags (abfd, ".iplt", flags);
- htab->iplt = s;
+ htab->elf.iplt = s;
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 4))
return FALSE;
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.iplt", flags);
- htab->reliplt = s;
+ htab->elf.irelplt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
htab = ppc_elf_hash_table (info);
- if (htab->got == NULL
+ if (htab->elf.sgot == NULL
&& !ppc_elf_create_got (abfd, info))
return FALSE;
&& !elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2))
return FALSE;
- htab->relplt = bfd_get_linker_section (abfd, ".rela.plt");
- htab->plt = s = bfd_get_linker_section (abfd, ".plt");
- if (s == NULL)
- abort ();
-
+ s = htab->elf.splt;
flags = SEC_ALLOC | SEC_CODE | SEC_LINKER_CREATED;
if (htab->plt_type == PLT_VXWORKS)
/* The VxWorks PLT is a loaded section with contents. */
This shows up in particular in an R_PPC_ADDR32 in the eabi
startup code. */
if (h != NULL
- && htab->got == NULL
+ && htab->elf.sgot == NULL
&& strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
{
if (htab->elf.dynobj == NULL)
case R_PPC_GOT16_HI:
case R_PPC_GOT16_HA:
/* This symbol requires a global offset table entry. */
- if (htab->got == NULL)
+ if (htab->elf.sgot == NULL)
{
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
| SEC_IN_MEMORY | SEC_LINKER_CREATED);
/* The new PLT is a loaded section. */
- if (htab->plt != NULL
- && !bfd_set_section_flags (htab->elf.dynobj, htab->plt, flags))
+ if (htab->elf.splt != NULL
+ && !bfd_set_section_flags (htab->elf.dynobj, htab->elf.splt, flags))
return -1;
/* The new GOT is not executable. */
- if (htab->got != NULL
- && !bfd_set_section_flags (htab->elf.dynobj, htab->got, flags))
+ if (htab->elf.sgot != NULL
+ && !bfd_set_section_flags (htab->elf.dynobj, htab->elf.sgot, flags))
return -1;
}
else
htab->params->no_tls_get_addr_opt = TRUE;
}
if (htab->plt_type == PLT_NEW
- && htab->plt != NULL
- && htab->plt->output_section != NULL)
+ && htab->elf.splt != NULL
+ && htab->elf.splt->output_section != NULL)
{
- elf_section_type (htab->plt->output_section) = SHT_PROGBITS;
- elf_section_flags (htab->plt->output_section) = SHF_ALLOC + SHF_WRITE;
+ elf_section_type (htab->elf.splt->output_section) = SHT_PROGBITS;
+ elf_section_flags (htab->elf.splt->output_section) = SHF_ALLOC + SHF_WRITE;
}
return _bfd_elf_tls_setup (obfd, info);
if (htab->plt_type == PLT_VXWORKS)
{
- where = htab->got->size;
- htab->got->size += need;
+ where = htab->elf.sgot->size;
+ htab->elf.sgot->size += need;
}
else
{
}
else
{
- if (htab->got->size + need > max_before_header
- && htab->got->size <= max_before_header)
+ if (htab->elf.sgot->size + need > max_before_header
+ && htab->elf.sgot->size <= max_before_header)
{
- htab->got_gap = max_before_header - htab->got->size;
- htab->got->size = max_before_header + htab->got_header_size;
+ htab->got_gap = max_before_header - htab->elf.sgot->size;
+ htab->elf.sgot->size = max_before_header + htab->got_header_size;
}
- where = htab->got->size;
- htab->got->size += need;
+ where = htab->elf.sgot->size;
+ htab->elf.sgot->size += need;
}
}
return where;
|| h->type == STT_GNU_IFUNC
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
{
- asection *s = htab->plt;
+ asection *s = htab->elf.splt;
if (!dyn || h->dynindx == -1)
- s = htab->iplt;
+ s = htab->elf.iplt;
if (htab->plt_type == PLT_NEW || !dyn || h->dynindx == -1)
{
{
if (!htab->elf.dynamic_sections_created
|| h->dynindx == -1)
- htab->reliplt->size += sizeof (Elf32_External_Rela);
+ htab->elf.irelplt->size += sizeof (Elf32_External_Rela);
else
{
- htab->relplt->size += sizeof (Elf32_External_Rela);
+ htab->elf.srelplt->size += sizeof (Elf32_External_Rela);
if (htab->plt_type == PLT_VXWORKS)
{
/* Every PLT entry has an associated GOT entry in
.got.plt. */
- htab->sgotplt->size += 4;
+ htab->elf.sgotplt->size += 4;
}
}
doneone = TRUE;
&& (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
|| eh->elf.root.type != bfd_link_hash_undefweak))
{
- asection *rsec = htab->relgot;
+ asection *rsec = htab->elf.srelgot;
if (eh->elf.type == STT_GNU_IFUNC)
- rsec = htab->reliplt;
+ rsec = htab->elf.irelplt;
/* All the entries we allocated need relocs.
Except LD only needs one. */
if ((eh->tls_mask & TLS_LD) != 0
{
asection *sreloc = elf_section_data (p->sec)->sreloc;
if (eh->elf.type == STT_GNU_IFUNC)
- sreloc = htab->reliplt;
+ sreloc = htab->elf.irelplt;
sreloc->size += p->count * sizeof (Elf32_External_Rela);
}
{
asection *sreloc = elf_section_data (p->sec)->sreloc;
if (p->ifunc)
- sreloc = htab->reliplt;
+ sreloc = htab->elf.irelplt;
sreloc->size += p->count * sizeof (Elf32_External_Rela);
if ((p->sec->output_section->flags
& (SEC_READONLY | SEC_ALLOC))
*local_got = allocate_got (htab, need);
if (bfd_link_pic (info))
{
- asection *srel = htab->relgot;
+ asection *srel = htab->elf.srelgot;
if ((*lgot_masks & PLT_IFUNC) != 0)
- srel = htab->reliplt;
+ srel = htab->elf.irelplt;
srel->size += need * (sizeof (Elf32_External_Rela) / 4);
}
}
for (ent = *local_plt; ent != NULL; ent = ent->next)
if (ent->plt.refcount > 0)
{
- s = htab->iplt;
+ s = htab->elf.iplt;
if (!doneone)
{
if (!doneone)
{
- htab->reliplt->size += sizeof (Elf32_External_Rela);
+ htab->elf.irelplt->size += sizeof (Elf32_External_Rela);
doneone = TRUE;
}
}
{
htab->tlsld_got.offset = allocate_got (htab, 8);
if (bfd_link_pic (info))
- htab->relgot->size += sizeof (Elf32_External_Rela);
+ htab->elf.srelgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tlsld_got.offset = (bfd_vma) -1;
- if (htab->got != NULL && htab->plt_type != PLT_VXWORKS)
+ if (htab->elf.sgot != NULL && htab->plt_type != PLT_VXWORKS)
{
unsigned int g_o_t = 32768;
for old plt/got the got size will be 0 to 32764 (not allocated),
or 32780 to 65536 (header allocated). For new plt/got, the
corresponding ranges are 0 to 32768 and 32780 to 65536. */
- if (htab->got->size <= 32768)
+ if (htab->elf.sgot->size <= 32768)
{
- g_o_t = htab->got->size;
+ g_o_t = htab->elf.sgot->size;
if (htab->plt_type == PLT_OLD)
g_o_t += 4;
- htab->got->size += htab->got_header_size;
+ htab->elf.sgot->size += htab->got_header_size;
}
htab->elf.hgot->root.u.def.value = g_o_t;
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->plt
- || s == htab->got)
+ if (s == htab->elf.splt
+ || s == htab->elf.sgot)
{
/* We'd like to strip these sections if they aren't needed, but if
we've exported dynamic symbols from them we must leave them.
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (s == htab->iplt
+ else if (s == htab->elf.iplt
|| s == htab->glink
|| s == htab->glink_eh_frame
- || s == htab->sgotplt
+ || s == htab->elf.sgotplt
|| s == htab->sbss
|| s == htab->dynbss
|| s == htab->dynsbss)
return FALSE;
}
- if (htab->plt != NULL && htab->plt->size != 0)
+ if (htab->elf.splt != NULL && htab->elf.splt->size != 0)
{
if (!add_dynamic_entry (DT_PLTGOT, 0)
|| !add_dynamic_entry (DT_PLTRELSZ, 0)
}
else
{
- tsec = htab->plt;
+ tsec = htab->elf.splt;
toff = ent->plt.offset;
}
}
insn_offset = 0;
}
stub_rtype = R_PPC_RELAX;
- if (tsec == htab->plt
+ if (tsec == htab->elf.splt
|| tsec == htab->glink)
{
stub_rtype = R_PPC_RELAX_PLT;
bfd_put_32 (input_bfd, B | off,
contents + rel->r_offset - d_offset);
- got_addr = (htab->got->output_section->vma
- + htab->got->output_offset
+ got_addr = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset
+ (h->got.offset & ~1));
wrel->r_offset = (p - contents) + d_offset;
wrel->r_info = ELF32_R_INFO (0, R_PPC_ADDR16_HA);
Elf_Internal_Rela rela;
bfd_byte *loc;
- rela.r_offset = (htab->iplt->output_section->vma
- + htab->iplt->output_offset
+ rela.r_offset = (htab->elf.iplt->output_section->vma
+ + htab->elf.iplt->output_offset
+ ent->plt.offset);
rela.r_info = ELF32_R_INFO (0, R_PPC_IRELATIVE);
rela.r_addend = relocation;
- loc = htab->reliplt->contents;
- loc += (htab->reliplt->reloc_count++
+ loc = htab->elf.irelplt->contents;
+ loc += (htab->elf.irelplt->reloc_count++
* sizeof (Elf32_External_Rela));
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
{
unsigned char *p = ((unsigned char *) htab->glink->contents
+ ent->glink_offset);
- write_glink_stub (ent, htab->iplt, p, info);
+ write_glink_stub (ent, htab->elf.iplt, p, info);
ent->glink_offset |= 1;
}
+ htab->glink->output_offset
+ (ent->glink_offset & ~1));
else
- relocation = (htab->plt->output_section->vma
- + htab->plt->output_offset
+ relocation = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ ent->plt.offset);
}
}
bfd_vma *offp;
unsigned long indx;
- if (htab->got == NULL)
+ if (htab->elf.sgot == NULL)
abort ();
indx = 0;
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
{
- asection *rsec = htab->relgot;
+ asection *rsec = htab->elf.srelgot;
bfd_byte * loc;
if (ifunc != NULL)
- rsec = htab->reliplt;
- outrel.r_offset = (htab->got->output_section->vma
- + htab->got->output_offset
+ rsec = htab->elf.irelplt;
+ outrel.r_offset = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset
+ off);
outrel.r_addend = 0;
if (tls_ty & (TLS_LD | TLS_GD))
if (tls_ty == (TLS_TLS | TLS_GD))
{
bfd_put_32 (input_bfd, value,
- htab->got->contents + off + 4);
+ htab->elf.sgot->contents + off + 4);
value = 1;
}
}
bfd_put_32 (input_bfd, value,
- htab->got->contents + off);
+ htab->elf.sgot->contents + off);
}
off += 4;
if (r_type != ELF32_R_TYPE (rel->r_info))
goto copy_reloc;
- relocation = (htab->got->output_section->vma
- + htab->got->output_offset
+ relocation = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset
+ off
- SYM_VAL (htab->elf.hgot));
time. */
sreloc = elf_section_data (input_section)->sreloc;
if (ifunc)
- sreloc = htab->reliplt;
+ sreloc = htab->elf.irelplt;
if (sreloc == NULL)
return FALSE;
+ htab->glink->output_offset
+ ent->glink_offset);
else
- relocation = (htab->plt->output_section->vma
- + htab->plt->output_offset
+ relocation = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ ent->plt.offset);
}
/* Fall through. */
ent = find_plt_ent (&h->plt.plist, got2,
bfd_link_pic (info) ? addend : 0);
if (ent == NULL
- || htab->plt == NULL)
+ || htab->elf.splt == NULL)
{
/* We didn't make a PLT entry for this symbol. This
happens when statically linking PIC code, or when
+ htab->glink->output_offset
+ ent->glink_offset);
else
- relocation = (htab->plt->output_section->vma
- + htab->plt->output_offset
+ relocation = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ ent->plt.offset);
}
}
{
bfd_put_32 (output_bfd,
plt_entry[0] | PPC_HA (got_offset),
- htab->plt->contents + ent->plt.offset + 0);
+ htab->elf.splt->contents + ent->plt.offset + 0);
bfd_put_32 (output_bfd,
plt_entry[1] | PPC_LO (got_offset),
- htab->plt->contents + ent->plt.offset + 4);
+ htab->elf.splt->contents + ent->plt.offset + 4);
}
else
{
bfd_put_32 (output_bfd,
plt_entry[0] | PPC_HA (got_loc),
- htab->plt->contents + ent->plt.offset + 0);
+ htab->elf.splt->contents + ent->plt.offset + 0);
bfd_put_32 (output_bfd,
plt_entry[1] | PPC_LO (got_loc),
- htab->plt->contents + ent->plt.offset + 4);
+ htab->elf.splt->contents + ent->plt.offset + 4);
}
bfd_put_32 (output_bfd, plt_entry[2],
- htab->plt->contents + ent->plt.offset + 8);
+ htab->elf.splt->contents + ent->plt.offset + 8);
bfd_put_32 (output_bfd, plt_entry[3],
- htab->plt->contents + ent->plt.offset + 12);
+ htab->elf.splt->contents + ent->plt.offset + 12);
/* This instruction is an immediate load. The value loaded is
the byte offset of the R_PPC_JMP_SLOT relocation from the
prescaled offset. */
bfd_put_32 (output_bfd,
plt_entry[4] | reloc_index,
- htab->plt->contents + ent->plt.offset + 16);
+ htab->elf.splt->contents + ent->plt.offset + 16);
/* This instruction is a PC-relative branch whose target is
the start of the PLT section. The address of this branch
instruction is 20 bytes beyond the start of this PLT entry.
bfd_put_32 (output_bfd,
(plt_entry[5]
| (-(ent->plt.offset + 20) & 0x03fffffc)),
- htab->plt->contents + ent->plt.offset + 20);
+ htab->elf.splt->contents + ent->plt.offset + 20);
bfd_put_32 (output_bfd, plt_entry[6],
- htab->plt->contents + ent->plt.offset + 24);
+ htab->elf.splt->contents + ent->plt.offset + 24);
bfd_put_32 (output_bfd, plt_entry[7],
- htab->plt->contents + ent->plt.offset + 28);
+ htab->elf.splt->contents + ent->plt.offset + 28);
/* Fill in the GOT entry corresponding to this PLT slot with
the address immediately after the "bctr" instruction
in this PLT entry. */
- bfd_put_32 (output_bfd, (htab->plt->output_section->vma
- + htab->plt->output_offset
+ bfd_put_32 (output_bfd, (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ ent->plt.offset + 16),
- htab->sgotplt->contents + got_offset);
+ htab->elf.sgotplt->contents + got_offset);
if (!bfd_link_pic (info))
{
* sizeof (Elf32_External_Rela));
/* Provide the @ha relocation for the first instruction. */
- rela.r_offset = (htab->plt->output_section->vma
- + htab->plt->output_offset
+ rela.r_offset = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ ent->plt.offset + 2);
rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx,
R_PPC_ADDR16_HA);
loc += sizeof (Elf32_External_Rela);
/* Provide the @l relocation for the second instruction. */
- rela.r_offset = (htab->plt->output_section->vma
- + htab->plt->output_offset
+ rela.r_offset = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ ent->plt.offset + 6);
rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx,
R_PPC_ADDR16_LO);
/* Provide a relocation for the GOT entry corresponding to this
PLT slot. Point it at the middle of the .plt entry. */
- rela.r_offset = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
+ rela.r_offset = (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset
+ got_offset);
rela.r_info = ELF32_R_INFO (htab->elf.hplt->indx,
R_PPC_ADDR32);
address of the PLT entry for this function, as specified
by the ABI. Instead, the offset is set to the address of
the GOT slot for this function. See EABI 4.4.4.1. */
- rela.r_offset = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
+ rela.r_offset = (htab->elf.sgotplt->output_section->vma
+ + htab->elf.sgotplt->output_offset
+ got_offset);
}
else
{
- asection *splt = htab->plt;
+ asection *splt = htab->elf.splt;
if (!htab->elf.dynamic_sections_created
|| h->dynindx == -1)
- splt = htab->iplt;
+ splt = htab->elf.iplt;
rela.r_offset = (splt->output_section->vma
+ splt->output_offset
if (!htab->elf.dynamic_sections_created
|| h->dynindx == -1)
- loc = (htab->reliplt->contents
- + (htab->reliplt->reloc_count++
+ loc = (htab->elf.irelplt->contents
+ + (htab->elf.irelplt->reloc_count++
* sizeof (Elf32_External_Rela)));
else
- loc = (htab->relplt->contents
+ loc = (htab->elf.srelplt->contents
+ reloc_index * sizeof (Elf32_External_Rela));
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
|| h->dynindx == -1)
{
unsigned char *p;
- asection *splt = htab->plt;
+ asection *splt = htab->elf.splt;
if (!htab->elf.dynamic_sections_created
|| h->dynindx == -1)
- splt = htab->iplt;
+ splt = htab->elf.iplt;
p = (unsigned char *) htab->glink->contents + ent->glink_offset;
{
struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
- if (rel_sec == htab->reliplt)
+ if (rel_sec == htab->elf.irelplt)
return reloc_class_ifunc;
switch (ELF32_R_TYPE (rela->r_info))
#endif
htab = ppc_elf_hash_table (info);
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->elf.dynobj;
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (htab->is_vxworks)
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = htab->elf.splt;
else
splt = NULL;
{
Elf32_External_Dyn *dyncon, *dynconend;
- BFD_ASSERT (htab->plt != NULL && sdyn != NULL);
+ BFD_ASSERT (htab->elf.splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);
{
case DT_PLTGOT:
if (htab->is_vxworks)
- s = htab->sgotplt;
+ s = htab->elf.sgotplt;
else
- s = htab->plt;
+ s = htab->elf.splt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->relplt->size;
+ dyn.d_un.d_val = htab->elf.srelplt->size;
break;
case DT_JMPREL:
- s = htab->relplt;
+ s = htab->elf.srelplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_RELASZ:
if (htab->is_vxworks)
{
- if (htab->relplt)
- dyn.d_un.d_ptr -= htab->relplt->size;
+ if (htab->elf.srelplt)
+ dyn.d_un.d_ptr -= htab->elf.srelplt->size;
break;
}
continue;
}
}
- if (htab->got != NULL)
+ if (htab->elf.sgot != NULL)
{
- if (htab->elf.hgot->root.u.def.section == htab->got
- || htab->elf.hgot->root.u.def.section == htab->sgotplt)
+ if (htab->elf.hgot->root.u.def.section == htab->elf.sgot
+ || htab->elf.hgot->root.u.def.section == htab->elf.sgotplt)
{
unsigned char *p = htab->elf.hgot->root.u.def.section->contents;
/* xgettext:c-format */
info->callbacks->einfo (_("%P: %s not defined in linker created %s\n"),
htab->elf.hgot->root.root.string,
- (htab->sgotplt != NULL
- ? htab->sgotplt->name : htab->got->name));
+ (htab->elf.sgotplt != NULL
+ ? htab->elf.sgotplt->name
+ : htab->elf.sgot->name));
bfd_set_error (bfd_error_bad_value);
ret = FALSE;
}
- elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
+ elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
}
/* Fill in the first entry in the VxWorks procedure linkage table. */
loc = htab->srelplt2->contents;
/* Output the @ha relocation for the first instruction. */
- rela.r_offset = (htab->plt->output_section->vma
- + htab->plt->output_offset
+ rela.r_offset = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ 2);
rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_HA);
rela.r_addend = 0;
loc += sizeof (Elf32_External_Rela);
/* Output the @l relocation for the second instruction. */
- rela.r_offset = (htab->plt->output_section->vma
- + htab->plt->output_offset
+ rela.r_offset = (htab->elf.splt->output_section->vma
+ + htab->elf.splt->output_offset
+ 6);
rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_LO);
rela.r_addend = 0;
struct elf_link_hash_entry ** sym_hashes;
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
- bfd *dynobj;
asection *splt;
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
- dynobj = elf_hash_table (info)->dynobj;
- splt = NULL;
- if (dynobj != NULL)
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
for (rel = relocs; rel < relend; rel ++)
{
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_plt_offsets = elf_local_got_offsets (abfd);
- splt = NULL;
dynobj = elf_hash_table(info)->dynobj;
rel_end = relocs + sec->reloc_count;
case R_RL78_DIR16S:
if (dynobj == NULL)
elf_hash_table (info)->dynobj = dynobj = abfd;
+ splt = elf_hash_table (info)->splt;
if (splt == NULL)
{
- splt = bfd_get_linker_section (dynobj, ".plt");
- if (splt == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY | SEC_CODE);
- splt = bfd_make_section_anyway_with_flags (dynobj, ".plt",
- flags);
- if (splt == NULL
- || ! bfd_set_section_alignment (dynobj, splt, 1))
- return FALSE;
- }
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY | SEC_CODE);
+ splt = bfd_make_section_anyway_with_flags (dynobj, ".plt",
+ flags);
+ elf_hash_table (info)->splt = splt;
+ if (splt == NULL
+ || ! bfd_set_section_alignment (dynobj, splt, 1))
+ return FALSE;
}
if (h != NULL)
if (info->relax_trip > 0)
return TRUE;
- if ((dynobj = elf_hash_table (info)->dynobj) != NULL
- && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL)
+ dynobj = elf_hash_table (info)->dynobj;
+ splt = elf_hash_table (info)->splt;
+ if (dynobj != NULL && splt != NULL)
{
bfd_byte *contents = splt->contents;
unsigned int i, size = splt->size;
if (dynobj == NULL)
return TRUE;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL);
splt->contents = (bfd_byte *) bfd_zalloc (dynobj, splt->size);
return &ret->elf.root;
}
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj, struct bfd_link_info *info)
-{
- struct elf_s390_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf_s390_hash_table (info);
- htab->elf.sgot = bfd_get_linker_section (dynobj, ".got");
- htab->elf.sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- htab->elf.srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (!htab->elf.sgot || !htab->elf.sgotplt || !htab->elf.srelgot)
- abort ();
-
- return TRUE;
-}
-
/* 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. */
struct elf_s390_link_hash_table *htab;
htab = elf_s390_hash_table (info);
- if (!htab->elf.sgot && !create_got_section (dynobj, 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->elf.splt = bfd_get_linker_section (dynobj, ".plt");
- htab->elf.srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
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.dynobj == NULL)
htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
return FALSE;
}
}
/* We have to use an alignment of 2**4 here because this is hardcoded
in the function stub generation and in the linker script. */
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
- if (s == NULL
+ elf_hash_table (info)->sgot = s;
+ if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4))
return FALSE;
h->non_elf = 0;
h->def_regular = 1;
h->type = STT_OBJECT;
+ elf_hash_table (info)->hgot = h;
if (bfd_link_pic (info) && ! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
break;
case DT_PLTGOT:
- name = ".got";
- s = bfd_get_linker_section (dynobj, name);
+ s = elf_hash_table (info)->sgot;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
/* We have to use an alignment of 2**4 here because this is hardcoded
in the function stub generation and in the linker script. */
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
- if (s == NULL
+ elf_hash_table (info)->sgot = s;
+ if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4))
return FALSE;
h->non_elf = 0;
h->def_regular = 1;
h->type = STT_OBJECT;
+ elf_hash_table (info)->hgot = h;
if (bfd_link_pic (info)
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
break;
case DT_PLTGOT:
- name = ".got";
- s = bfd_get_linker_section (dynobj, name);
+ s = elf_hash_table (info)->sgot;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sdynbss;
asection *srelbss;
asection *sfuncdesc;
if (htab == NULL)
return FALSE;
- htab->sgot = bfd_get_linker_section (dynobj, ".got");
- htab->sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
- abort ();
-
htab->sfuncdesc = bfd_make_section_anyway_with_flags (dynobj, ".got.funcdesc",
(SEC_ALLOC | SEC_LOAD
| SEC_HAS_CONTENTS
pltflags |= SEC_READONLY;
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
- htab->splt = s;
+ htab->root.splt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
bed->default_use_rela_p
? ".rela.plt" : ".rel.plt",
flags | SEC_READONLY);
- htab->srelplt = s;
+ htab->root.srelplt = s;
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign))
return FALSE;
- if (htab->sgot == NULL
+ if (htab->root.sgot == NULL
&& !create_got_section (abfd, info))
return FALSE;
if (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
- asection *s = htab->splt;
+ asection *s = htab->root.splt;
const struct elf_sh_plt_info *plt_info;
/* If this is the first .plt entry, make room for the special
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
if (!htab->fdpic_p)
- htab->sgotplt->size += 4;
+ htab->root.sgotplt->size += 4;
else
- htab->sgotplt->size += 8;
+ htab->root.sgotplt->size += 8;
/* We also need to make an entry in the .rel.plt section. */
- htab->srelplt->size += sizeof (Elf32_External_Rela);
+ htab->root.srelplt->size += sizeof (Elf32_External_Rela);
if (htab->vxworks_p && !bfd_link_pic (info))
{
return FALSE;
}
- s = htab->sgot;
+ s = htab->root.sgot;
h->got.offset = s->size;
s->size += 4;
/* R_SH_TLS_GD needs 2 consecutive GOT slots. */
R_SH_TLS_GD needs one if local symbol and two if global. */
else if ((got_type == GOT_TLS_GD && h->dynindx == -1)
|| got_type == GOT_TLS_IE)
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
else if (got_type == GOT_TLS_GD)
- htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += 2 * sizeof (Elf32_External_Rela);
else if (got_type == GOT_FUNCDESC)
{
if (!bfd_link_pic (info) && SYMBOL_FUNCDESC_LOCAL (info, h))
htab->srofixup->size += 4;
else
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak)
&& (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
else if (htab->fdpic_p
&& !bfd_link_pic (info)
&& got_type == GOT_NORMAL
return FALSE;
}
- s = htab->sgot;
+ s = htab->root.sgot;
eh->datalabel_got.offset = s->size;
s->size += 4;
dyn = htab->root.dynamic_sections_created;
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
else
eh->datalabel_got.offset = (bfd_vma) -1;
if (!bfd_link_pic (info) && SYMBOL_FUNCDESC_LOCAL (info, h))
htab->srofixup->size += eh->abs_funcdesc_refcount * 4;
else
- htab->srelgot->size
+ htab->root.srelgot->size
+= eh->abs_funcdesc_refcount * sizeof (Elf32_External_Rela);
}
/* Count datalabel local GOT. */
locsymcount *= 2;
#endif
- s = htab->sgot;
- srel = htab->srelgot;
+ s = htab->root.sgot;
+ srel = htab->root.srelgot;
local_got = elf_local_got_refcounts (ibfd);
if (local_got)
{
/* Allocate 2 got entries and 1 dynamic reloc for R_SH_TLS_LD_32
relocs. */
- htab->tls_ldm_got.offset = htab->sgot->size;
- htab->sgot->size += 8;
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->tls_ldm_got.offset = htab->root.sgot->size;
+ htab->root.sgot->size += 8;
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
else
htab->tls_ldm_got.offset = -1;
the end of .got.plt. */
if (htab->fdpic_p)
{
- BFD_ASSERT (htab->sgotplt && htab->sgotplt->size == 12);
- htab->sgotplt->size = 0;
+ BFD_ASSERT (htab->root.sgotplt && htab->root.sgotplt->size == 12);
+ htab->root.sgotplt->size = 0;
}
/* Allocate global sym .plt and .got entries, and space for global
end of the FDPIC .got.plt. */
if (htab->fdpic_p)
{
- htab->root.hgot->root.u.def.value = htab->sgotplt->size;
- htab->sgotplt->size += 12;
+ htab->root.hgot->root.u.def.value = htab->root.sgotplt->size;
+ htab->root.sgotplt->size += 12;
}
/* At the very end of the .rofixup section is a pointer to the GOT. */
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (s == htab->splt
- || s == htab->sgot
- || s == htab->sgotplt
+ if (s == htab->root.splt
+ || s == htab->root.sgot
+ || s == htab->root.sgotplt
|| s == htab->sfuncdesc
|| s == htab->srofixup
|| s == htab->sdynbss)
}
else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
- if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2)
+ if (s->size != 0 && s != htab->root.srelplt && s != htab->srelplt2)
relocs = TRUE;
/* We use the reloc_count field as a counter if we need
return FALSE;
}
- if (htab->splt->size != 0)
+ if (htab->root.splt->size != 0)
{
if (! add_dynamic_entry (DT_PLTGOT, 0)
|| ! add_dynamic_entry (DT_PLTRELSZ, 0)
static bfd_signed_vma
sh_elf_got_offset (struct elf_sh_link_hash_table *htab)
{
- return (htab->sgot->output_offset - htab->sgotplt->output_offset
+ return (htab->root.sgot->output_offset - htab->root.sgotplt->output_offset
- htab->root.hgot->root.u.def.value);
}
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- bfd *dynobj = NULL;
bfd_vma *local_got_offsets;
asection *sgot = NULL;
asection *sgotplt = NULL;
htab = sh_elf_hash_table (info);
if (htab != NULL)
{
- dynobj = htab->root.dynobj;
- sgot = htab->sgot;
- sgotplt = htab->sgotplt;
- splt = htab->splt;
+ sgot = htab->root.sgot;
+ sgotplt = htab->root.sgotplt;
+ srelgot = htab->root.srelgot;
+ splt = htab->root.splt;
fdpic_p = htab->fdpic_p;
}
symtab_hdr = &elf_symtab_hdr (input_bfd);
Elf_Internal_Rela outrel;
bfd_byte *loc;
- if (srelgot == NULL)
- {
- srelgot = bfd_get_linker_section (dynobj,
- ".rela.got");
- BFD_ASSERT (srelgot != NULL);
- }
-
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
+ off);
return FALSE;
}
- if (srelgot == NULL)
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
- }
-
offset = _bfd_elf_section_offset (output_bfd, info,
reloc_section, reloc_offset);
bfd_byte *loc;
int dr_type, indx;
- if (srelgot == NULL)
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
- }
-
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset + off);
Elf_Internal_Rela outrel;
bfd_byte *loc;
- srelgot = htab->srelgot;
- if (srelgot == NULL)
- abort ();
-
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset + off);
outrel.r_addend = 0;
}
/* Some relocs require a global offset table. */
- if (htab->sgot == NULL)
+ if (htab->root.sgot == NULL)
{
switch (r_type)
{
if (!bfd_link_pic (info))
htab->srofixup->size += 4;
else
- htab->srelgot->size += sizeof (Elf32_External_Rela);
+ htab->root.srelgot->size += sizeof (Elf32_External_Rela);
}
}
else
BFD_ASSERT (h->dynindx != -1);
- splt = htab->splt;
- sgotplt = htab->sgotplt;
- srelplt = htab->srelplt;
+ splt = htab->root.splt;
+ sgotplt = htab->root.sgotplt;
+ srelplt = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgotplt != NULL && srelplt != NULL);
/* Get the index in the procedure linkage table which
sgotplt->contents + got_offset);
if (htab->fdpic_p)
bfd_put_32 (output_bfd,
- sh_elf_osec_to_segment (output_bfd,
- htab->splt->output_section),
+ sh_elf_osec_to_segment (output_bfd, splt->output_section),
sgotplt->contents + got_offset + 4);
/* Fill in the entry in the .rela.plt section. */
/* Create a .rela.plt.unloaded R_SH_DIR32 relocation
for the PLT entry's pointer to the .got.plt entry. */
- rel.r_offset = (htab->splt->output_section->vma
- + htab->splt->output_offset
+ rel.r_offset = (splt->output_section->vma
+ + splt->output_offset
+ h->plt.offset
+ plt_info->symbol_fields.got_entry);
rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_SH_DIR32);
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = htab->sgot;
- srelgot = htab->srelgot;
+ sgot = htab->root.sgot;
+ srelgot = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srelgot != NULL);
rel.r_offset = (sgot->output_section->vma
/* This symbol has a datalabel entry in the global offset table.
Set it up. */
- sgot = htab->sgot;
- srelgot = htab->srelgot;
+ sgot = htab->root.sgot;
+ srelgot = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srelgot != NULL);
rel.r_offset = (sgot->output_section->vma
if (htab == NULL)
return FALSE;
- sgotplt = htab->sgotplt;
+ sgotplt = htab->root.sgotplt;
sdyn = bfd_get_linker_section (htab->root.dynobj, ".dynamic");
if (htab->root.dynamic_sections_created)
break;
case DT_JMPREL:
- s = htab->srelplt->output_section;
+ s = htab->root.srelplt->output_section;
BFD_ASSERT (s != NULL);
dyn.d_un.d_ptr = s->vma;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = htab->srelplt->output_section;
+ s = htab->root.srelplt->output_section;
BFD_ASSERT (s != NULL);
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- if (htab->srelplt != NULL)
+ if (htab->root.srelplt != NULL)
{
- s = htab->srelplt->output_section;
+ s = htab->root.srelplt->output_section;
dyn.d_un.d_val -= s->size;
}
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
}
/* Fill in the first entry in the procedure linkage table. */
- splt = htab->splt;
+ splt = htab->root.splt;
if (splt && splt->size > 0 && htab->plt_info->plt0_entry)
{
unsigned int i;
BFD_ASSERT (htab->srelfuncdesc->reloc_count * sizeof (Elf32_External_Rela)
== htab->srelfuncdesc->size);
- if (htab->srelgot)
- BFD_ASSERT (htab->srelgot->reloc_count * sizeof (Elf32_External_Rela)
- == htab->srelgot->size);
+ if (htab->root.srelgot)
+ BFD_ASSERT (htab->root.srelgot->reloc_count * sizeof (Elf32_External_Rela)
+ == htab->root.srelgot->size);
return TRUE;
}
struct elf_link_hash_entry *h,
Elf_Internal_Sym * sym)
{
- bfd *dynobj;
struct elf32_tic6x_link_hash_table *htab;
htab = elf32_tic6x_hash_table (info);
- dynobj = htab->elf.dynobj;
if (h->plt.offset != (bfd_vma) -1)
{
/* This symbol has an entry in the global offset table.
Set it up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srela = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = htab->elf.sgot;
+ srela = htab->elf.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
/* If this is a -Bsymbolic link, and the symbol is defined
struct elf_link_hash_table *htab = elf_hash_table (info);
/* This function may be called more than once. */
- s = bfd_get_linker_section (abfd, ".got");
- if (s != NULL)
+ if (htab->sgot != NULL)
return TRUE;
flags = bed->dynamic_sec_flags;
struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
- asection *sgot;
- asection *srelgot;
asection *sreloc;
if (bfd_link_relocatable (info))
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
- sgot = NULL;
- srelgot = NULL;
sreloc = NULL;
rel_end = relocs + sec->reloc_count;
return FALSE;
}
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL
- && (h != NULL || bfd_link_pic (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
-
- srelgot = bfd_make_section_anyway_with_flags (dynobj,
- ".rela.got",
- flags);
- if (srelgot == NULL
- || !bfd_set_section_alignment (dynobj, srelgot, 2))
- return FALSE;
- }
- }
-
if (h != NULL)
{
struct elf_vax_link_hash_entry *eh;
return TRUE;
}
- s = bfd_get_linker_section (dynobj, ".plt");
+ s = elf_hash_table (info)->splt;
BFD_ASSERT (s != NULL);
/* If this is the first .plt entry, make room for the special
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- s = bfd_get_linker_section (dynobj, ".got.plt");
+ s = elf_hash_table (info)->sgotplt;
BFD_ASSERT (s != NULL);
s->size += 4;
/* We also need to make an entry in the .rela.plt section. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf32_External_Rela);
not actually use these entries. Reset the size of .rela.got
and .got, which will cause them to get stripped from the output
file below. */
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
if (s != NULL)
s->size = 0;
- s = bfd_get_linker_section (dynobj, ".got.plt");
+ s = elf_hash_table (info)->sgotplt;
if (s != NULL)
s->size = 0;
- s = bfd_get_linker_section (dynobj, ".got");
+ s = elf_hash_table (info)->sgot;
if (s != NULL)
s->size = 0;
}
dynobj = elf_hash_table (info)->dynobj;
BFD_ASSERT (dynobj != NULL);
- sgot = bfd_get_linker_section (dynobj, ".got");
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
if (SYMBOL_REFERENCES_LOCAL (info, h))
{
Elf_Internal_Sym *local_syms,
asection **local_sections)
{
- bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
bfd_vma plt_index;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
{
bfd_vma off;
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
+ sgot = elf_hash_table (info)->sgot;
+ BFD_ASSERT (sgot != NULL);
off = h->got.offset;
BFD_ASSERT (off < sgot->size);
|| h->plt.offset == (bfd_vma) -1)
break;
- if (splt == NULL)
- {
- splt = bfd_get_linker_section (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- }
+ splt = elf_hash_table (info)->splt;
+ BFD_ASSERT (splt != NULL);
- if (sgotplt == NULL)
- {
- sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- BFD_ASSERT (sgotplt != NULL);
- }
+ sgotplt = elf_hash_table (info)->sgotplt;
+ BFD_ASSERT (sgotplt != NULL);
plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
it up. */
BFD_ASSERT (h->dynindx != -1);
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
- srela = bfd_get_linker_section (dynobj, ".rela.plt");
+ splt = elf_hash_table (info)->splt;
+ sgot = elf_hash_table (info)->sgotplt;
+ srela = elf_hash_table (info)->srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
addend = 2 * (h->plt.offset & 1);
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srela = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srela = elf_hash_table (info)->srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
dynobj = elf_hash_table (info)->dynobj;
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
+ sgot = elf_hash_table (info)->sgotplt;
BFD_ASSERT (sgot != NULL);
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char *name;
asection *s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
break;
case DT_PLTGOT:
- name = ".got.plt";
+ s = elf_hash_table (info)->sgotplt;
goto get_vma;
case DT_JMPREL:
- name = ".rela.plt";
+ s = elf_hash_table (info)->srelplt;
get_vma:
- s = bfd_get_linker_section (dynobj, name);
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
dyn.d_un.d_val = s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s != NULL)
dyn.d_un.d_val -= s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
symtab_hdr = &elf_tdata(abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
local_plt_offsets = elf_local_got_offsets (abfd);
- splt = NULL;
dynobj = elf_hash_table(info)->dynobj;
relend = relocs + sec->reloc_count;
if (dynobj == NULL)
elf_hash_table (info)->dynobj = dynobj = abfd;
+ splt = elf_hash_table (info)->splt;
if (splt == NULL)
{
- splt = bfd_get_linker_section (dynobj, ".plt");
- if (splt == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY | SEC_CODE);
-
- splt = bfd_make_section_anyway_with_flags (dynobj, ".plt",
- flags);
- if (splt == NULL
- || ! bfd_set_section_alignment (dynobj, splt, 1))
- return FALSE;
- }
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY | SEC_CODE);
+
+ splt = bfd_make_section_anyway_with_flags (dynobj, ".plt",
+ flags);
+ elf_hash_table (info)->splt = splt;
+ if (splt == NULL
+ || ! bfd_set_section_alignment (dynobj, splt, 1))
+ return FALSE;
}
if (h != NULL)
if (dynobj == NULL)
return TRUE;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL);
splt->contents = bfd_zalloc (dynobj, splt->size);
struct elf_link_hash_entry ** sym_hashes;
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
- bfd *dynobj;
asection *splt;
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
- dynobj = elf_hash_table (info)->dynobj;
- splt = NULL;
- if (dynobj != NULL)
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
for (rel = relocs; rel < relend; rel ++)
{
xstormy16_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
- bfd *dynobj;
- asection *splt;
+ bfd *dynobj = elf_hash_table (info)->dynobj;
+ asection *splt = elf_hash_table (info)->splt;
/* As an extra sanity check, verify that all plt entries have
been filled in. */
- if ((dynobj = elf_hash_table (info)->dynobj) != NULL
- && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL)
+ if (dynobj != NULL && splt != NULL)
{
bfd_byte *contents = splt->contents;
unsigned int i, size = splt->size;
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sgotloc;
asection *spltlittbl;
/* First do all the standard stuff. */
if (! _bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
- htab->splt = bfd_get_linker_section (dynobj, ".plt");
- htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
- htab->sgot = bfd_get_linker_section (dynobj, ".got");
- htab->sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got");
/* Create any extra PLT sections in case check_relocs has already
been called on all the non-dynamic input files. */
flags = noalloc_flags | SEC_ALLOC | SEC_LOAD;
/* Mark the ".got.plt" section READONLY. */
- if (htab->sgotplt == NULL
- || ! bfd_set_section_flags (dynobj, htab->sgotplt, flags))
+ if (htab->elf.sgotplt == NULL
+ || ! bfd_set_section_flags (dynobj, htab->elf.sgotplt, flags))
return FALSE;
/* Create ".got.loc" (literal tables for use by dynamic linker). */
elf_xtensa_make_sym_local (info, h);
if (h->plt.refcount > 0)
- htab->srelplt->size += (h->plt.refcount * sizeof (Elf32_External_Rela));
+ htab->elf.srelplt->size += (h->plt.refcount * sizeof (Elf32_External_Rela));
if (h->got.refcount > 0)
- htab->srelgot->size += (h->got.refcount * sizeof (Elf32_External_Rela));
+ htab->elf.srelgot->size += (h->got.refcount * sizeof (Elf32_External_Rela));
return TRUE;
}
}
if (local_got_refcounts[j] > 0)
- htab->srelgot->size += (local_got_refcounts[j]
- * sizeof (Elf32_External_Rela));
+ htab->elf.srelgot->size += (local_got_refcounts[j]
+ * sizeof (Elf32_External_Rela));
}
}
}
dynobj = elf_hash_table (info)->dynobj;
if (dynobj == NULL)
abort ();
- srelgot = htab->srelgot;
- srelplt = htab->srelplt;
+ srelgot = htab->elf.srelgot;
+ srelplt = htab->elf.srelplt;
if (elf_hash_table (info)->dynamic_sections_created)
{
- BFD_ASSERT (htab->srelgot != NULL
- && htab->srelplt != NULL
- && htab->sgot != NULL
+ BFD_ASSERT (htab->elf.srelgot != NULL
+ && htab->elf.srelplt != NULL
+ && htab->elf.sgot != NULL
&& htab->spltlittbl != NULL
&& htab->sgotloc != NULL);
}
/* Allocate room for one word in ".got". */
- htab->sgot->size = 4;
+ htab->elf.sgot->size = 4;
/* Allocate space in ".rela.got" for literals that reference global
symbols and space in ".rela.plt" for literals that have PLT
asection *srel;
if (dynamic_symbol && r_type == R_XTENSA_PLT)
- srel = htab->srelplt;
+ srel = htab->elf.srelplt;
else
- srel = htab->srelgot;
+ srel = htab->elf.srelgot;
BFD_ASSERT (srel != NULL);
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
- asection *srel = htab->srelgot;
+ asection *srel = htab->elf.srelgot;
int indx;
outrel.r_offset = (input_section->output_section->vma
/* Set the first entry in the global offset table to the address of
the dynamic section. */
- sgot = htab->sgot;
+ sgot = htab->elf.sgot;
if (sgot)
{
BFD_ASSERT (sgot->size == 4);
sgot->contents);
}
- srelplt = htab->srelplt;
+ srelplt = htab->elf.srelplt;
if (srelplt && srelplt->size != 0)
{
asection *sgotplt, *srelgot, *spltlittbl;
bfd_byte *loc;
unsigned rtld_reloc;
- srelgot = htab->srelgot;
+ srelgot = htab->elf.srelgot;
spltlittbl = htab->spltlittbl;
BFD_ASSERT (srelgot != NULL && spltlittbl != NULL);
break;
case DT_PLTGOT:
- dyn.d_un.d_ptr = (htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ dyn.d_un.d_ptr = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset);
break;
case DT_JMPREL:
- dyn.d_un.d_ptr = (htab->srelplt->output_section->vma
- + htab->srelplt->output_offset);
+ dyn.d_un.d_ptr = (htab->elf.srelplt->output_section->vma
+ + htab->elf.srelplt->output_offset);
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->srelplt->size;
+ dyn.d_un.d_val = htab->elf.srelplt->size;
break;
case DT_RELASZ:
seems to be unresolved. Since the linker script arranges
for .rela.plt to follow all other relocation sections, we
don't have to worry about changing the DT_RELA entry. */
- if (htab->srelplt)
- dyn.d_un.d_val -= htab->srelplt->size;
+ if (htab->elf.srelplt)
+ dyn.d_un.d_val -= htab->elf.srelplt->size;
break;
}
if (dynamic_symbol && r_type == R_XTENSA_PLT)
{
- srel = htab->srelplt;
+ srel = htab->elf.srelplt;
is_plt = TRUE;
}
else
- srel = htab->srelgot;
+ srel = htab->elf.srelgot;
/* Reduce size of the .rela.* section by one reloc. */
BFD_ASSERT (srel != NULL);
if (reloc_index % PLT_ENTRIES_PER_CHUNK == 0)
{
/* The two magic GOT entries for that chunk can go away. */
- srelgot = htab->srelgot;
+ srelgot = htab->elf.srelgot;
BFD_ASSERT (srelgot != NULL);
srelgot->reloc_count -= 2;
srelgot->size -= 2 * sizeof (Elf32_External_Rela);
static asection *
elf_xtensa_get_plt_section (struct bfd_link_info *info, int chunk)
{
- struct elf_xtensa_link_hash_table *htab;
bfd *dynobj;
char plt_name[10];
if (chunk == 0)
- {
- htab = elf_xtensa_hash_table (info);
- if (htab == NULL)
- return NULL;
-
- return htab->splt;
- }
+ return elf_hash_table (info)->splt;
dynobj = elf_hash_table (info)->dynobj;
sprintf (plt_name, ".plt.%u", chunk);
static asection *
elf_xtensa_get_gotplt_section (struct bfd_link_info *info, int chunk)
{
- struct elf_xtensa_link_hash_table *htab;
bfd *dynobj;
char got_name[14];
if (chunk == 0)
- {
- htab = elf_xtensa_hash_table (info);
- if (htab == NULL)
- return NULL;
- return htab->sgotplt;
- }
+ return elf_hash_table (info)->sgotplt;
dynobj = elf_hash_table (info)->dynobj;
sprintf (got_name, ".got.plt.%u", chunk);
/* Find the corresponding ".got.plt*" section. */
if (sec->name[4] == '\0')
- sgotplt = bfd_get_linker_section (sec->owner, ".got.plt");
+ sgotplt = elf_hash_table (link_info)->sgotplt;
else
{
char got_name[14];
| SEC_LINKER_CREATED
| (elf64_alpha_use_secureplt ? SEC_READONLY : 0));
s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags);
+ elf_hash_table (info)->splt = s;
if (s == NULL || ! bfd_set_section_alignment (abfd, s, 4))
return FALSE;
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED | SEC_READONLY);
s = bfd_make_section_anyway_with_flags (abfd, ".rela.plt", flags);
+ elf_hash_table (info)->srelplt = s;
if (s == NULL || ! bfd_set_section_alignment (abfd, s, 3))
return FALSE;
{
flags = SEC_ALLOC | SEC_LINKER_CREATED;
s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
+ elf_hash_table (info)->sgotplt = s;
if (s == NULL || ! bfd_set_section_alignment (abfd, s, 3))
return FALSE;
}
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED | SEC_READONLY);
s = bfd_make_section_anyway_with_flags (abfd, ".rela.got", flags);
+ elf_hash_table (info)->srelgot = s;
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3))
return FALSE;
{
h->needs_plt = TRUE;
- s = bfd_get_linker_section (dynobj, ".plt");
+ s = elf_hash_table(info)->splt;
if (!s && !elf64_alpha_create_dynamic_sections (dynobj, info))
return FALSE;
{
asection *splt, *spltrel, *sgotplt;
unsigned long entries;
- bfd *dynobj;
struct alpha_elf_link_hash_table * htab;
htab = alpha_elf_hash_table (info);
if (htab == NULL)
return;
- dynobj = elf_hash_table(info)->dynobj;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table(info)->splt;
if (splt == NULL)
return;
elf64_alpha_size_plt_section_1, splt);
/* Every plt entry requires a JMP_SLOT relocation. */
- spltrel = bfd_get_linker_section (dynobj, ".rela.plt");
+ spltrel = elf_hash_table(info)->srelplt;
entries = 0;
if (splt->size)
{
entire contents of the .got.plt section. */
if (elf64_alpha_use_secureplt)
{
- sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
+ sgotplt = elf_hash_table(info)->sgotplt;
sgotplt->size = entries ? 16 : 0;
}
}
if (entries > 0)
{
- bfd *dynobj = elf_hash_table(info)->dynobj;
- asection *srel = bfd_get_linker_section (dynobj, ".rela.got");
+ asection *srel = elf_hash_table(info)->srelgot;
BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf64_External_Rela) * entries;
}
elf64_alpha_size_rela_got_section (struct bfd_link_info *info)
{
unsigned long entries;
- bfd *i, *dynobj;
+ bfd *i;
asection *srel;
struct alpha_elf_link_hash_table * htab;
}
}
- dynobj = elf_hash_table(info)->dynobj;
- srel = bfd_get_linker_section (dynobj, ".rela.got");
+ srel = elf_hash_table(info)->srelgot;
if (!srel)
{
BFD_ASSERT (entries == 0);
symtab_hdr = &elf_symtab_hdr (input_bfd);
dynobj = elf_hash_table (info)->dynobj;
- if (dynobj)
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- else
- srelgot = NULL;
+ srelgot = elf_hash_table (info)->srelgot;
if (input_section->flags & SEC_ALLOC)
{
Elf_Internal_Sym *sym)
{
struct alpha_elf_link_hash_entry *ah = (struct alpha_elf_link_hash_entry *)h;
- bfd *dynobj = elf_hash_table(info)->dynobj;
if (h->needs_plt)
{
BFD_ASSERT (h->dynindx != -1);
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL);
- srel = bfd_get_linker_section (dynobj, ".rela.plt");
+ srel = elf_hash_table (info)->srelplt;
BFD_ASSERT (srel != NULL);
for (gotent = ah->got_entries; gotent ; gotent = gotent->next)
asection *srel;
struct alpha_elf_got_entry *gotent;
- srel = bfd_get_linker_section (dynobj, ".rela.got");
+ srel = elf_hash_table (info)->srelgot;
BFD_ASSERT (srel != NULL);
for (gotent = ((struct alpha_elf_link_hash_entry *) h)->got_entries;
Elf64_External_Dyn *dyncon, *dynconend;
bfd_vma plt_vma, gotplt_vma;
- splt = bfd_get_linker_section (dynobj, ".plt");
- srelaplt = bfd_get_linker_section (dynobj, ".rela.plt");
+ splt = elf_hash_table (info)->splt;
+ srelaplt = elf_hash_table (info)->srelplt;
BFD_ASSERT (splt != NULL && sdyn != NULL);
plt_vma = splt->output_section->vma + splt->output_offset;
gotplt_vma = 0;
if (elf64_alpha_use_secureplt)
{
- sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
+ sgotplt = elf_hash_table (info)->sgotplt;
BFD_ASSERT (sgotplt != NULL);
if (sgotplt->size > 0)
gotplt_vma = sgotplt->output_section->vma + sgotplt->output_offset;
if (hppa_info == NULL)
return FALSE;
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = hppa_info->root.dynobj;
BFD_ASSERT (dynobj != NULL);
/* Mark each function this program exports so that we will allocate
We have to traverse the main linker hash table since we have to
find functions which may not have been mentioned in any relocs. */
- elf_link_hash_traverse (elf_hash_table (info),
- (elf_hash_table (info)->dynamic_sections_created
+ elf_link_hash_traverse (&hppa_info->root,
+ (hppa_info->root.dynamic_sections_created
? elf64_hppa_mark_milli_and_exported_functions
: elf64_hppa_mark_exported_functions),
info);
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (hppa_info->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
if (bfd_link_executable (info) && !info->nointerp)
not actually use these entries. Reset the size of .rela.dlt,
which will cause it to get stripped from the output file
below. */
- sec = bfd_get_linker_section (dynobj, ".rela.dlt");
+ sec = hppa_info->dlt_rel_sec;
if (sec != NULL)
sec->size = 0;
}
if (hppa_info->dlt_sec)
{
data.ofs = hppa_info->dlt_sec->size;
- elf_link_hash_traverse (elf_hash_table (info),
+ elf_link_hash_traverse (&hppa_info->root,
allocate_global_data_dlt, &data);
hppa_info->dlt_sec->size = data.ofs;
}
if (hppa_info->plt_sec)
{
data.ofs = hppa_info->plt_sec->size;
- elf_link_hash_traverse (elf_hash_table (info),
+ elf_link_hash_traverse (&hppa_info->root,
allocate_global_data_plt, &data);
hppa_info->plt_sec->size = data.ofs;
}
if (hppa_info->stub_sec)
{
data.ofs = 0x0;
- elf_link_hash_traverse (elf_hash_table (info),
+ elf_link_hash_traverse (&hppa_info->root,
allocate_global_data_stub, &data);
hppa_info->stub_sec->size = data.ofs;
}
if (hppa_info->opd_sec)
{
data.ofs = hppa_info->opd_sec->size;
- elf_link_hash_traverse (elf_hash_table (info),
+ elf_link_hash_traverse (&hppa_info->root,
allocate_global_data_opd, &data);
hppa_info->opd_sec->size = data.ofs;
}
/* Now allocate space for dynamic relocations, if necessary. */
if (hppa_info->root.dynamic_sections_created)
- elf_link_hash_traverse (elf_hash_table (info),
+ elf_link_hash_traverse (&hppa_info->root,
allocate_dynrel_entries, &data);
/* The sizes of all the sections are set. Allocate memory for them. */
}
}
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (hppa_info->root.dynamic_sections_created)
{
/* Always create a DT_PLTGOT. It actually has nothing to do with
the PLT, it is how we communicate the __gp value of a load
return &ret->elf.root;
}
-/* Create .got, .gotplt, and .rela.got sections in DYNOBJ, and set up
- shortcuts to them in our hash table. */
-
-static bfd_boolean
-create_got_section (bfd *dynobj,
- struct bfd_link_info *info)
-{
- struct elf_s390_link_hash_table *htab;
-
- if (! _bfd_elf_create_got_section (dynobj, info))
- return FALSE;
-
- htab = elf_s390_hash_table (info);
- if (htab == NULL)
- return FALSE;
-
- htab->elf.sgot = bfd_get_linker_section (dynobj, ".got");
- htab->elf.sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- htab->elf.srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (!htab->elf.sgot || !htab->elf.sgotplt || !htab->elf.srelgot)
- abort ();
- return TRUE;
-}
-
/* 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. */
if (htab == NULL)
return FALSE;
- if (!htab->elf.sgot && !create_got_section (dynobj, 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->elf.splt = bfd_get_linker_section (dynobj, ".plt");
- htab->elf.srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
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.dynobj == NULL)
htab->elf.dynobj = abfd;
- if (!create_got_section (htab->elf.dynobj, info))
+ if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
return FALSE;
}
}
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- bfd *dynobj;
bfd_vma *local_got_offsets;
asection *sgot;
asection *sgotplt;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
- dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
- sgot = NULL;
- sgotplt = NULL;
- splt = NULL;
sreloc = NULL;
rel = relocs;
/* Relocation is to the entry for this symbol in the global
offset table extension for the procedure linkage table. */
- if (sgotplt == NULL)
- {
- sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- BFD_ASSERT (sgotplt != NULL);
- }
+ sgotplt = elf_hash_table (info)->sgotplt;
+ BFD_ASSERT (sgotplt != NULL);
relocation = (sgotplt->output_offset
+ ((h->plt.offset / elf_sh64_sizeof_plt (info)
case R_SH_GOT10BY8:
/* Relocation is to the entry for this symbol in the global
offset table. */
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
+ sgot = elf_hash_table (info)->sgot;
+ BFD_ASSERT (sgot != NULL);
if (h != NULL)
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
BFD_ASSERT (s != NULL);
outrel.r_offset = (sgot->output_section->vma
/* Relocation is relative to the start of the global offset
table. */
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
+ sgot = elf_hash_table (info)->sgot;
+ BFD_ASSERT (sgot != NULL);
/* Note that sgot->output_offset is not involved in this
calculation. We always want the start of .got. If we
case R_SH_GOTPC_HI16:
/* Use global offset table as symbol value. */
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
+ sgot = elf_hash_table (info)->sgot;
+ BFD_ASSERT (sgot != NULL);
relocation = sgot->output_section->vma;
goto final_link_relocate;
}
- if (splt == NULL)
- {
- splt = bfd_get_linker_section (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- }
+ splt = elf_hash_table (info)->splt;
+ BFD_ASSERT (splt != NULL);
relocation = (splt->output_section->vma
+ splt->output_offset
asection *srelgot;
asection *sreloc;
- sgot = NULL;
- srelgot = NULL;
sreloc = NULL;
if (bfd_link_relocatable (info))
case R_SH_GOT10BY8:
/* This symbol requires a global offset table entry. */
- if (sgot == NULL)
- {
- sgot = bfd_get_linker_section (dynobj, ".got");
- BFD_ASSERT (sgot != NULL);
- }
-
- if (srelgot == NULL
- && (h != NULL || bfd_link_pic (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY);
- srelgot = bfd_make_section_anyway_with_flags (dynobj,
- ".rela.got",
- flags);
- if (srelgot == NULL
- || ! bfd_set_section_alignment (dynobj, srelgot, 2))
- return FALSE;
- }
- }
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
+ BFD_ASSERT (sgot != NULL && srelgot != NULL);
if (h != NULL)
{
return FALSE;
}
- s = bfd_get_linker_section (dynobj, ".plt");
+ s = elf_hash_table (info)->splt;
BFD_ASSERT (s != NULL);
/* If this is the first .plt entry, make room for the special
/* We also need to make an entry in the .got.plt section, which
will be placed in the .got section by the linker script. */
- s = bfd_get_linker_section (dynobj, ".got.plt");
+ s = elf_hash_table (info)->sgotplt;
BFD_ASSERT (s != NULL);
s->size += 8;
/* We also need to make an entry in the .rela.plt section. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf64_External_Rela);
not actually use these entries. Reset the size of .rela.got,
which will cause it to get stripped from the output file
below. */
- s = bfd_get_linker_section (dynobj, ".rela.got");
+ s = elf_hash_table (info)->srelgot;
if (s != NULL)
s->size = 0;
}
BFD_ASSERT (h->dynindx != -1);
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
- srel = bfd_get_linker_section (dynobj, ".rela.plt");
+ splt = elf_hash_table (info)->splt;
+ sgot = elf_hash_table (info)->sgotplt;
+ srel = elf_hash_table (info)->srelplt;
BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL);
/* Get the index in the procedure linkage table which
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srel = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srel = elf_hash_table (info)->srelgot;
BFD_ASSERT (sgot != NULL && srel != NULL);
rel.r_offset = (sgot->output_section->vma
dynobj = elf_hash_table (info)->dynobj;
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
+ sgot = elf_hash_table (info)->sgotplt;
BFD_ASSERT (sgot != NULL);
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
break;
case DT_PLTGOT:
- name = ".got.plt";
+ s = elf_hash_table (info)->sgotplt;
goto get_vma;
case DT_JMPREL:
- name = ".rela.plt";
+ s = elf_hash_table (info)->srelplt;
get_vma:
- s = bfd_get_linker_section (dynobj, name);
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
dyn.d_un.d_val = s->size;
bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
the linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s != NULL)
dyn.d_un.d_val -= s->size;
bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
}
/* Fill in the first entry in the procedure linkage table. */
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
if (splt && splt->size > 0)
{
if (bfd_link_pic (info))
struct elf_link_hash_table *htab = elf_hash_table (info);
/* This function may be called more than once. */
- s = bfd_get_linker_section (abfd, ".got");
- if (s != NULL)
+ if (htab->sgot != NULL)
return TRUE;
flags = bed->dynamic_sec_flags;
struct elf_link_hash_table *htab = elf_hash_table (info);
/* This function may be called more than once. */
- s = bfd_get_linker_section (abfd, ".got");
- if (s != NULL)
+ if (htab->sgot != NULL)
return TRUE;
flags = bed->dynamic_sec_flags;
bfd *dynobj;
bfd_boolean relplt = FALSE;
- dynobj = elf_hash_table(info)->dynobj;
ia64_info = elfNN_ia64_hash_table (info);
if (ia64_info == NULL)
return FALSE;
+ dynobj = ia64_info->root.dynobj;
ia64_info->self_dtpmod_offset = (bfd_vma) -1;
BFD_ASSERT(dynobj != NULL);
data.info = info;
/* If we've got a .plt, we need some extra memory for the dynamic
linker. We stuff these in .got.plt. */
- sec = bfd_get_linker_section (dynobj, ".got.plt");
- sec->size = 8 * PLT_RESERVED_WORDS;
+ ia64_info->root.sgotplt->size = 8 * PLT_RESERVED_WORDS;
}
/* Allocate the PLTOFF entries. */
}
}
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (ia64_info->root.dynamic_sections_created)
{
/* Add some entries to the .dynamic section. We fill in the values
later (in finish_dynamic_sections) but we must add the entries now
dynobj = ia64_info->root.dynobj;
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (ia64_info->root.dynamic_sections_created)
{
ElfNN_External_Dyn *dyncon, *dynconend;
asection *sdyn, *sgotplt;
bfd_vma gp_val;
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
- sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
+ sgotplt = ia64_info->root.sgotplt;
BFD_ASSERT (sdyn != NULL);
dyncon = (ElfNN_External_Dyn *) sdyn->contents;
dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->size);
struct elf_link_hash_table *htab = elf_hash_table (info);
/* This function may be called more than once. */
- s = bfd_get_linker_section (abfd, ".got");
- if (s != NULL)
+ if (htab->sgot != NULL)
return TRUE;
flags = bed->dynamic_sec_flags;
being used. */
asection *srelbss;
asection *sdynbss;
- asection *srelplt;
asection *srelplt2;
- asection *sgotplt;
- asection *splt;
asection *sstubs;
- asection *sgot;
/* The master GOT information. */
struct mips_got_info *got_info;
if (htab == NULL)
return;
- sgot = htab->sgot;
+ sgot = htab->root.sgot;
indx = 0;
if (h != NULL)
BFD_ASSERT (h->plt.plist->gotplt_index != MINUS_ONE);
/* Calculate the address of the associated .got.plt entry. */
- got_address = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
+ got_address = (htab->root.sgotplt->output_section->vma
+ + htab->root.sgotplt->output_offset
+ (h->plt.plist->gotplt_index
* MIPS_ELF_GOT_SIZE (info->output_bfd)));
g = mips_elf_bfd_got (obfd, FALSE);
got_index = ((h->dynindx - global_got_dynindx + g->local_gotno)
* MIPS_ELF_GOT_SIZE (obfd));
- BFD_ASSERT (got_index < htab->sgot->size);
+ BFD_ASSERT (got_index < htab->root.sgot->size);
return got_index;
}
BFD_ASSERT (entry);
gotidx = entry->gotidx;
- BFD_ASSERT (gotidx > 0 && gotidx < htab->sgot->size);
+ BFD_ASSERT (gotidx > 0 && gotidx < htab->root.sgot->size);
if (lookup.tls_type)
{
htab = mips_elf_hash_table (info);
BFD_ASSERT (htab != NULL);
- sgot = htab->sgot;
+ sgot = htab->root.sgot;
gp = _bfd_get_gp_value (output_bfd)
+ mips_elf_adjust_gp (output_bfd, htab->got_info, input_bfd);
BFD_ASSERT (entry);
gotidx = entry->gotidx;
- BFD_ASSERT (gotidx > 0 && gotidx < htab->sgot->size);
+ BFD_ASSERT (gotidx > 0 && gotidx < htab->root.sgot->size);
return entry;
}
*entry = lookup;
*loc = entry;
- MIPS_ELF_PUT_WORD (abfd, value, htab->sgot->contents + entry->gotidx);
+ MIPS_ELF_PUT_WORD (abfd, value, htab->root.sgot->contents + entry->gotidx);
/* These GOT entries need a dynamic relocation on VxWorks. */
if (htab->is_vxworks)
bfd_vma got_address;
s = mips_elf_rel_dyn_section (info, FALSE);
- got_address = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
+ got_address = (htab->root.sgot->output_section->vma
+ + htab->root.sgot->output_offset
+ entry->gotidx);
rloc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela));
BFD_ASSERT (htab != NULL);
/* This function may be called more than once. */
- if (htab->sgot)
+ if (htab->root.sgot)
return TRUE;
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4))
return FALSE;
- htab->sgot = s;
+ htab->root.sgot = s;
/* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the
linker script because we don't want to define the symbol if we
| SEC_LINKER_CREATED);
if (s == NULL)
return FALSE;
- htab->sgotplt = s;
+ htab->root.sgotplt = s;
return TRUE;
}
{
bfd_boolean micromips_p = MICROMIPS_P (abfd);
- sec = htab->splt;
+ sec = htab->root.splt;
symbol = (sec->output_section->vma
+ sec->output_offset
+ htab->plt_header_size
if (!TLS_RELOC_P (r_type)
&& !elf_hash_table (info)->dynamic_sections_created)
/* This is a static link. We must initialize the GOT entry. */
- MIPS_ELF_PUT_WORD (dynobj, symbol, htab->sgot->contents + g);
+ MIPS_ELF_PUT_WORD (dynobj, symbol, htab->root.sgot->contents + g);
}
}
else if (!htab->is_vxworks
return FALSE;
/* Cache the sections created above. */
- htab->splt = bfd_get_linker_section (abfd, ".plt");
htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
if (htab->is_vxworks)
- {
- htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
- htab->srelplt = bfd_get_linker_section (abfd, ".rela.plt");
- }
- else
- htab->srelplt = bfd_get_linker_section (abfd, ".rel.plt");
+ htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
if (!htab->sdynbss
|| (htab->is_vxworks && !htab->srelbss && !bfd_link_pic (info))
- || !htab->srelplt
- || !htab->splt)
+ || !htab->root.srelplt
+ || !htab->root.splt)
abort ();
/* Do the usual VxWorks handling. */
for PLT offset calculations. */
if (htab->plt_mips_offset + htab->plt_comp_offset == 0)
{
- BFD_ASSERT (htab->sgotplt->size == 0);
+ BFD_ASSERT (htab->root.sgotplt->size == 0);
BFD_ASSERT (htab->plt_got_index == 0);
/* If we're using the PLT additions to the psABI, each PLT
Encourage better cache usage by aligning. We do this
lazily to avoid pessimizing traditional objects. */
if (!htab->is_vxworks
- && !bfd_set_section_alignment (dynobj, htab->splt, 5))
+ && !bfd_set_section_alignment (dynobj, htab->root.splt, 5))
return FALSE;
/* Make sure that .got.plt is word-aligned. We do this lazily
for the same reason as above. */
- if (!bfd_set_section_alignment (dynobj, htab->sgotplt,
+ if (!bfd_set_section_alignment (dynobj, htab->root.sgotplt,
MIPS_ELF_LOG_FILE_ALIGN (dynobj)))
return FALSE;
hmips->use_plt_entry = TRUE;
/* Make room for the R_MIPS_JUMP_SLOT relocation. */
- htab->srelplt->size += (htab->is_vxworks
- ? MIPS_ELF_RELA_SIZE (dynobj)
- : MIPS_ELF_REL_SIZE (dynobj));
+ htab->root.srelplt->size += (htab->is_vxworks
+ ? MIPS_ELF_RELA_SIZE (dynobj)
+ : MIPS_ELF_REL_SIZE (dynobj));
/* Make room for the .rela.plt.unloaded relocations. */
if (htab->is_vxworks && !bfd_link_pic (info))
htab = mips_elf_hash_table (info);
BFD_ASSERT (htab != NULL);
- s = htab->sgot;
+ s = htab->root.sgot;
if (s == NULL)
return TRUE;
if (htab->is_vxworks)
val += 8;
- h->root.root.u.def.section = htab->splt;
+ h->root.root.u.def.section = htab->root.splt;
h->root.root.u.def.value = val;
h->root.other = other;
}
Also create the _PROCEDURE_LINKAGE_TABLE_ symbol if we
haven't already in _bfd_elf_create_dynamic_sections. */
- if (htab->splt && htab->plt_mips_offset + htab->plt_comp_offset != 0)
+ if (htab->root.splt && htab->plt_mips_offset + htab->plt_comp_offset != 0)
{
bfd_boolean micromips_p = (MICROMIPS_P (output_bfd)
&& !htab->plt_mips_offset);
bfd_vma size;
BFD_ASSERT (htab->use_plts_and_copy_relocs);
- BFD_ASSERT (htab->sgotplt->size == 0);
- BFD_ASSERT (htab->splt->size == 0);
+ BFD_ASSERT (htab->root.sgotplt->size == 0);
+ BFD_ASSERT (htab->root.splt->size == 0);
if (htab->is_vxworks && bfd_link_pic (info))
size = 4 * ARRAY_SIZE (mips_vxworks_shared_plt0_entry);
htab->plt_header_is_comp = micromips_p;
htab->plt_header_size = size;
- htab->splt->size = (size
- + htab->plt_mips_offset
- + htab->plt_comp_offset);
- htab->sgotplt->size = (htab->plt_got_index
- * MIPS_ELF_GOT_SIZE (dynobj));
+ htab->root.splt->size = (size
+ + htab->plt_mips_offset
+ + htab->plt_comp_offset);
+ htab->root.sgotplt->size = (htab->plt_got_index
+ * MIPS_ELF_GOT_SIZE (dynobj));
mips_elf_link_hash_traverse (htab, mips_elf_set_plt_sym_value, info);
if (htab->root.hplt == NULL)
{
- h = _bfd_elf_define_linkage_sym (dynobj, info, htab->splt,
+ h = _bfd_elf_define_linkage_sym (dynobj, info, htab->root.splt,
"_PROCEDURE_LINKAGE_TABLE_");
htab->root.hplt = h;
if (h == NULL)
else if (SGI_COMPAT (output_bfd)
&& CONST_STRNEQ (name, ".compact_rel"))
s->size += mips_elf_hash_table (info)->compact_rel_size;
- else if (s == htab->splt)
+ else if (s == htab->root.splt)
{
/* If the last PLT entry has a branch delay slot, allocate
room for an extra nop to fill the delay slot. This is
s->size += 4;
}
else if (! CONST_STRNEQ (name, ".init")
- && s != htab->sgot
- && s != htab->sgotplt
+ && s != htab->root.sgot
+ && s != htab->root.sgotplt
&& s != htab->sstubs
&& s != htab->sdynbss)
{
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_OPTIONS, 0))
return FALSE;
}
- if (htab->splt->size > 0)
+ if (htab->root.splt->size > 0)
{
if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTREL, 0))
return FALSE;
BFD_ASSERT (htab->use_plts_and_copy_relocs);
BFD_ASSERT (h->dynindx != -1);
- BFD_ASSERT (htab->splt != NULL);
+ BFD_ASSERT (htab->root.splt != NULL);
BFD_ASSERT (got_index != MINUS_ONE);
BFD_ASSERT (!h->def_regular);
/* Calculate the address of the PLT header. */
isa_bit = htab->plt_header_is_comp;
- header_address = (htab->splt->output_section->vma
- + htab->splt->output_offset + isa_bit);
+ header_address = (htab->root.splt->output_section->vma
+ + htab->root.splt->output_offset + isa_bit);
/* Calculate the address of the .got.plt entry. */
- got_address = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
+ got_address = (htab->root.sgotplt->output_section->vma
+ + htab->root.sgotplt->output_offset
+ got_index * MIPS_ELF_GOT_SIZE (dynobj));
got_address_high = ((got_address + 0x8000) >> 16) & 0xffff;
got_address_low = got_address & 0xffff;
/* Initially point the .got.plt entry at the PLT header. */
- loc = (htab->sgotplt->contents + got_index * MIPS_ELF_GOT_SIZE (dynobj));
+ loc = (htab->root.sgotplt->contents + got_index * MIPS_ELF_GOT_SIZE (dynobj));
if (ABI_64_P (output_bfd))
bfd_put_64 (output_bfd, header_address, loc);
else
plt_offset = htab->plt_header_size + h->plt.plist->mips_offset;
- BFD_ASSERT (plt_offset <= htab->splt->size);
+ BFD_ASSERT (plt_offset <= htab->root.splt->size);
/* Find out where the .plt entry should go. */
- loc = htab->splt->contents + plt_offset;
+ loc = htab->root.splt->contents + plt_offset;
/* Pick the load opcode. */
load = MIPS_ELF_LOAD_WORD (output_bfd);
plt_offset = (htab->plt_header_size + htab->plt_mips_offset
+ h->plt.plist->comp_offset);
- BFD_ASSERT (plt_offset <= htab->splt->size);
+ BFD_ASSERT (plt_offset <= htab->root.splt->size);
/* Find out where the .plt entry should go. */
- loc = htab->splt->contents + plt_offset;
+ loc = htab->root.splt->contents + plt_offset;
/* Fill in the PLT entry itself. */
if (!MICROMIPS_P (output_bfd))
BFD_ASSERT (got_address % 4 == 0);
- loc_address = (htab->splt->output_section->vma
- + htab->splt->output_offset + plt_offset);
+ loc_address = (htab->root.splt->output_section->vma
+ + htab->root.splt->output_offset + plt_offset);
gotpc_offset = got_address - ((loc_address | 3) ^ 3);
/* ADDIUPC has a span of +/-16MB, check we're in range. */
(_("%B: `%A' offset of %ld from `%A' "
"beyond the range of ADDIUPC"),
output_bfd,
- htab->sgotplt->output_section,
- htab->splt->output_section,
+ htab->root.sgotplt->output_section,
+ htab->root.splt->output_section,
(long) gotpc_offset);
bfd_set_error (bfd_error_no_error);
return FALSE;
}
/* Emit an R_MIPS_JUMP_SLOT relocation against the .got.plt entry. */
- mips_elf_output_dynamic_relocation (output_bfd, htab->srelplt,
+ mips_elf_output_dynamic_relocation (output_bfd, htab->root.srelplt,
got_index - 2, h->dynindx,
R_MIPS_JUMP_SLOT, got_address);
BFD_ASSERT (h->dynindx != -1
|| h->forced_local);
- sgot = htab->sgot;
+ sgot = htab->root.sgot;
g = htab->got_info;
BFD_ASSERT (g != NULL);
&e)))
{
offset = p->gotidx;
- BFD_ASSERT (offset > 0 && offset < htab->sgot->size);
+ BFD_ASSERT (offset > 0 && offset < htab->root.sgot->size);
if (bfd_link_pic (info)
|| (elf_hash_table (info)->dynamic_sections_created
&& p->d.h != NULL
gotplt_index = h->plt.plist->gotplt_index;
BFD_ASSERT (h->dynindx != -1);
- BFD_ASSERT (htab->splt != NULL);
+ BFD_ASSERT (htab->root.splt != NULL);
BFD_ASSERT (gotplt_index != MINUS_ONE);
- BFD_ASSERT (plt_offset <= htab->splt->size);
+ BFD_ASSERT (plt_offset <= htab->root.splt->size);
/* Calculate the address of the .plt entry. */
- plt_address = (htab->splt->output_section->vma
- + htab->splt->output_offset
+ plt_address = (htab->root.splt->output_section->vma
+ + htab->root.splt->output_offset
+ plt_offset);
/* Calculate the address of the .got.plt entry. */
- got_address = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset
+ got_address = (htab->root.sgotplt->output_section->vma
+ + htab->root.sgotplt->output_offset
+ gotplt_index * MIPS_ELF_GOT_SIZE (output_bfd));
/* Calculate the offset of the .got.plt entry from
/* Fill in the initial value of the .got.plt entry. */
bfd_put_32 (output_bfd, plt_address,
- (htab->sgotplt->contents
+ (htab->root.sgotplt->contents
+ gotplt_index * MIPS_ELF_GOT_SIZE (output_bfd)));
/* Find out where the .plt entry should go. */
- loc = htab->splt->contents + plt_offset;
+ loc = htab->root.splt->contents + plt_offset;
if (bfd_link_pic (info))
{
}
/* Emit an R_MIPS_JUMP_SLOT relocation against the .got.plt entry. */
- loc = (htab->srelplt->contents
+ loc = (htab->root.srelplt->contents
+ gotplt_index * sizeof (Elf32_External_Rela));
rel.r_offset = got_address;
rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_JUMP_SLOT);
BFD_ASSERT (h->dynindx != -1 || h->forced_local);
- sgot = htab->sgot;
+ sgot = htab->root.sgot;
g = htab->got_info;
BFD_ASSERT (g != NULL);
plt_entry = micromips_o32_exec_plt0_entry;
/* Calculate the value of .got.plt. */
- gotplt_value = (htab->sgotplt->output_section->vma
- + htab->sgotplt->output_offset);
+ gotplt_value = (htab->root.sgotplt->output_section->vma
+ + htab->root.sgotplt->output_offset);
gotplt_value_high = ((gotplt_value + 0x8000) >> 16) & 0xffff;
gotplt_value_low = gotplt_value & 0xffff;
|| ~(gotplt_value | 0x7fffffff) == 0);
/* Install the PLT header. */
- loc = htab->splt->contents;
+ loc = htab->root.splt->contents;
if (plt_entry == micromips_o32_exec_plt0_entry)
{
bfd_vma gotpc_offset;
BFD_ASSERT (gotplt_value % 4 == 0);
- loc_address = (htab->splt->output_section->vma
- + htab->splt->output_offset);
+ loc_address = (htab->root.splt->output_section->vma
+ + htab->root.splt->output_offset);
gotpc_offset = gotplt_value - ((loc_address | 3) ^ 3);
/* ADDIUPC has a span of +/-16MB, check we're in range. */
/* xgettext:c-format */
(_("%B: `%A' offset of %ld from `%A' beyond the range of ADDIUPC"),
output_bfd,
- htab->sgotplt->output_section,
- htab->splt->output_section,
+ htab->root.sgotplt->output_section,
+ htab->root.splt->output_section,
(long) gotpc_offset);
bfd_set_error (bfd_error_no_error);
return FALSE;
got_value_low = got_value & 0xffff;
/* Calculate the address of the PLT header. */
- plt_address = htab->splt->output_section->vma + htab->splt->output_offset;
+ plt_address = (htab->root.splt->output_section->vma
+ + htab->root.splt->output_offset);
/* Install the PLT header. */
- loc = htab->splt->contents;
+ loc = htab->root.splt->contents;
bfd_put_32 (output_bfd, plt_entry[0] | got_value_high, loc);
bfd_put_32 (output_bfd, plt_entry[1] | got_value_low, loc + 4);
bfd_put_32 (output_bfd, plt_entry[2], loc + 8);
/* We just need to copy the entry byte-by-byte. */
for (i = 0; i < ARRAY_SIZE (mips_vxworks_shared_plt0_entry); i++)
bfd_put_32 (output_bfd, mips_vxworks_shared_plt0_entry[i],
- htab->splt->contents + i * 4);
+ htab->root.splt->contents + i * 4);
}
/* Finish up the dynamic sections. */
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
- sgot = htab->sgot;
+ sgot = htab->root.sgot;
gg = htab->got_info;
if (elf_hash_table (info)->dynamic_sections_created)
break;
case DT_PLTGOT:
- s = htab->sgot;
+ s = htab->root.sgot;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_MIPS_PLTGOT:
- s = htab->sgotplt;
+ s = htab->root.sgotplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_RELASZ:
BFD_ASSERT (htab->is_vxworks);
/* The count does not include the JUMP_SLOT relocations. */
- if (htab->srelplt)
- dyn.d_un.d_val -= htab->srelplt->size;
+ if (htab->root.srelplt)
+ dyn.d_un.d_val -= htab->root.srelplt->size;
break;
case DT_PLTREL:
case DT_PLTRELSZ:
BFD_ASSERT (htab->use_plts_and_copy_relocs);
- dyn.d_un.d_val = htab->srelplt->size;
+ dyn.d_un.d_val = htab->root.srelplt->size;
break;
case DT_JMPREL:
BFD_ASSERT (htab->use_plts_and_copy_relocs);
- dyn.d_un.d_ptr = (htab->srelplt->output_section->vma
- + htab->srelplt->output_offset);
+ dyn.d_un.d_ptr = (htab->root.srelplt->output_section->vma
+ + htab->root.srelplt->output_offset);
break;
case DT_TEXTREL:
}
}
- if (htab->splt && htab->splt->size > 0)
+ if (htab->root.splt && htab->root.splt->size > 0)
{
if (htab->is_vxworks)
{
for (dyncon = sdyn->contents; dyncon < dynconend; dyncon += dynsize)
{
Elf_Internal_Dyn dyn;
- const char *name;
bfd_boolean size;
bed->s->swap_dyn_in (dynobj, dyncon, &dyn);
}
else
{
+ asection *s;
+
switch (dyn.d_tag)
{
- case DT_PLTGOT: name = ".plt"; size = FALSE; break;
- case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break;
- case DT_JMPREL: name = ".rela.plt"; size = FALSE; break;
- default: name = NULL; size = FALSE; break;
+ case DT_PLTGOT:
+ s = htab->elf.splt;
+ size = FALSE;
+ break;
+ case DT_PLTRELSZ:
+ s = htab->elf.srelplt;
+ size = TRUE;
+ break;
+ case DT_JMPREL:
+ s = htab->elf.srelplt;
+ size = FALSE;
+ break;
+ default:
+ continue;
}
- if (name != NULL)
+ if (s == NULL)
+ dyn.d_un.d_val = 0;
+ else
{
- asection *s;
-
- s = bfd_get_linker_section (dynobj, name);
- if (s == NULL)
- dyn.d_un.d_val = 0;
+ if (!size)
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
else
- {
- if (! size)
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- else
- dyn.d_un.d_val = s->size;
- }
- bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
+ dyn.d_un.d_val = s->size;
}
+ bed->s->swap_dyn_out (output_bfd, &dyn, dyncon);
}
}
return TRUE;
struct elf_link_hash_table *htab = elf_hash_table (info);
/* This function may be called more than once. */
- s = bfd_get_linker_section (abfd, ".got");
- if (s != NULL)
+ if (htab->sgot != NULL)
return TRUE;
flags = bed->dynamic_sec_flags;