This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Delete duplicate target short-cuts to dynamic sections
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 23 Nov 2016 05:05:37 -0000
- Subject: [binutils-gdb] Delete duplicate target short-cuts to dynamic sections
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ce558b89b15a18fd67fdc02a4d410a6d92d2ba63
commit ce558b89b15a18fd67fdc02a4d410a6d92d2ba63
Author: Alan Modra <amodra@gmail.com>
Date: Wed Nov 23 15:06:34 2016 +1030
Delete duplicate target short-cuts to dynamic sections
We'd like to have the elf_link_hash_table srelplt field rather than
some private target field used to save short-cuts to a PLT relocation
section. This save a little space but mainly is so that the generic
ELF code can access the field. Ditto for other dynamic sections.
* 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.
Diff:
---
bfd/ChangeLog | 256 +++++++++++++++++++++++++++++++++++++++++++++
bfd/elf-m10300.c | 49 +++------
bfd/elf32-bfin.c | 88 +++++-----------
bfd/elf32-cr16.c | 65 ++++--------
bfd/elf32-cris.c | 134 ++++++------------------
bfd/elf32-frv.c | 31 ++----
bfd/elf32-hppa.c | 176 +++++++++++++++----------------
bfd/elf32-i370.c | 44 ++++----
bfd/elf32-lm32.c | 113 +++++++-------------
bfd/elf32-m32c.c | 37 +++----
bfd/elf32-m32r.c | 98 ++++++------------
bfd/elf32-m68k.c | 117 ++++++---------------
bfd/elf32-metag.c | 189 +++++++++++++++------------------
bfd/elf32-microblaze.c | 228 +++++++++++++++++-----------------------
bfd/elf32-nds32.c | 121 ++++++++--------------
bfd/elf32-nds32.h | 5 -
bfd/elf32-or1k.c | 123 +++++++---------------
bfd/elf32-ppc.c | 276 ++++++++++++++++++++++---------------------------
bfd/elf32-rl78.c | 36 +++----
bfd/elf32-s390.c | 27 +----
bfd/elf32-score.c | 7 +-
bfd/elf32-score7.c | 7 +-
bfd/elf32-sh.c | 146 ++++++++++----------------
bfd/elf32-tic6x.c | 6 +-
bfd/elf32-tilepro.c | 3 +-
bfd/elf32-vax.c | 92 +++++------------
bfd/elf32-xstormy16.c | 40 +++----
bfd/elf32-xtensa.c | 85 ++++++---------
bfd/elf64-alpha.c | 40 ++++---
bfd/elf64-hppa.c | 22 ++--
bfd/elf64-s390.c | 30 +-----
bfd/elf64-sh64.c | 101 ++++++------------
bfd/elflink.c | 3 +-
bfd/elfnn-aarch64.c | 3 +-
bfd/elfnn-ia64.c | 11 +-
bfd/elfnn-riscv.c | 3 +-
bfd/elfxx-mips.c | 181 +++++++++++++++-----------------
bfd/elfxx-sparc.c | 41 ++++----
bfd/elfxx-tilegx.c | 3 +-
39 files changed, 1297 insertions(+), 1740 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 77d97e8..3f43a5a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,261 @@
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.
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 688a270..0b62fa9 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1174,29 +1174,9 @@ mn10300_elf_check_relocs (bfd *abfd,
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)
{
@@ -1819,7 +1799,7 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
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);
@@ -1896,10 +1876,9 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
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
@@ -4973,7 +4952,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
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);
@@ -5078,7 +5057,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
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);
}
@@ -5242,7 +5221,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd,
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
@@ -5320,7 +5299,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd,
/* 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
@@ -5449,7 +5428,6 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd * output_bfd,
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char * name;
asection * s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
@@ -5460,19 +5438,18 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd * output_bfd,
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;
@@ -5487,7 +5464,7 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd * output_bfd,
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);
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index fdf0299..3076ec9 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1226,28 +1226,9 @@ bfin_check_relocs (bfd * abfd,
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)
{
@@ -1480,20 +1461,17 @@ bfin_relocate_section (bfd * output_bfd,
{
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;
@@ -1556,7 +1534,7 @@ bfin_relocate_section (bfd * output_bfd,
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
@@ -1684,8 +1662,8 @@ bfin_gc_sweep_hook (bfd * abfd,
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++)
@@ -1742,16 +1720,8 @@ struct bfinfdpic_elf_link_hash_table
{
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
@@ -1772,15 +1742,15 @@ struct bfinfdpic_elf_link_hash_table
== 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) \
@@ -3395,7 +3365,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *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;
@@ -3410,18 +3380,11 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
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
@@ -3446,7 +3409,6 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
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,
@@ -5129,10 +5091,6 @@ bfin_finish_dynamic_symbol (bfd * output_bfd,
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;
@@ -5143,8 +5101,8 @@ bfin_finish_dynamic_symbol (bfd * output_bfd,
/* 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
@@ -5395,7 +5353,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
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;
}
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 8fbe2ab..631445d 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -582,10 +582,11 @@ _bfd_cr16_elf_create_got_section (bfd * abfd, struct bfd_link_info * info)
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)
@@ -607,6 +608,7 @@ _bfd_cr16_elf_create_got_section (bfd * abfd, struct bfd_link_info * info)
| 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;
@@ -614,6 +616,7 @@ _bfd_cr16_elf_create_got_section (bfd * abfd, struct bfd_link_info * info)
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;
@@ -624,7 +627,7 @@ _bfd_cr16_elf_create_got_section (bfd * abfd, struct bfd_link_info * info)
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;
@@ -761,29 +764,9 @@ cr16_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
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)
{
@@ -870,9 +853,6 @@ cr16_elf_final_link_relocate (reloc_howto_type *howto,
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)
{
@@ -1056,7 +1036,7 @@ cr16_elf_final_link_relocate (reloc_howto_type *howto,
}
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)
{
@@ -1104,8 +1084,7 @@ cr16_elf_final_link_relocate (reloc_howto_type *howto,
}
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)
{
@@ -2248,6 +2227,7 @@ _bfd_cr16_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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)
@@ -2275,6 +2255,7 @@ _bfd_cr16_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
(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;
@@ -2373,13 +2354,13 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
/* 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);
@@ -2478,7 +2459,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
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;
}
@@ -2633,8 +2614,8 @@ _bfd_cr16_elf_finish_dynamic_symbol (bfd * output_bfd,
/* 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
@@ -2712,7 +2693,7 @@ _bfd_cr16_elf_finish_dynamic_sections (bfd * output_bfd,
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");
@@ -2729,7 +2710,6 @@ _bfd_cr16_elf_finish_dynamic_sections (bfd * output_bfd,
for (; dyncon < dynconend; dyncon++)
{
Elf_Internal_Dyn dyn;
- const char * name;
asection * s;
bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
@@ -2740,19 +2720,18 @@ _bfd_cr16_elf_finish_dynamic_sections (bfd * output_bfd,
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;
@@ -2767,7 +2746,7 @@ _bfd_cr16_elf_finish_dynamic_sections (bfd * output_bfd,
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);
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 9d6d0c4..7d38801 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -990,7 +990,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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);
@@ -1003,8 +1003,8 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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 ++)
@@ -1142,8 +1142,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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);
@@ -1275,9 +1274,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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
@@ -1599,7 +1596,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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))
@@ -1607,8 +1604,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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);
@@ -1752,8 +1748,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -1885,8 +1880,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -2095,7 +2089,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
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)
{
@@ -2139,9 +2133,9 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
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));
@@ -2238,8 +2232,8 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
/* 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
@@ -2318,7 +2312,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
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");
@@ -2327,7 +2321,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
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;
@@ -2352,14 +2346,14 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
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
@@ -2375,7 +2369,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
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);
@@ -2504,8 +2498,8 @@ cris_elf_gc_sweep_hook (bfd *abfd,
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++)
@@ -2755,13 +2749,11 @@ elf_cris_adjust_gotplt_to_got (struct elf_cris_link_hash_entry *h, void * p)
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;
@@ -2868,7 +2860,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
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
@@ -2936,7 +2928,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
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
@@ -2995,13 +2987,13 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
= 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);
@@ -3260,7 +3252,8 @@ cris_elf_check_relocs (bfd *abfd,
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)
@@ -3285,62 +3278,6 @@ cris_elf_check_relocs (bfd *abfd,
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)
{
@@ -3769,10 +3706,10 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -3794,7 +3731,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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;
}
@@ -4029,12 +3966,9 @@ elf_cris_discard_excess_program_dynamics (struct elf_cris_link_hash_entry *h,
&& 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);
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index a84ca7a..fa58543 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -805,16 +805,8 @@ struct frvfdpic_elf_link_hash_table
{
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
@@ -837,15 +829,15 @@ struct frvfdpic_elf_link_hash_table
== 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) \
@@ -4175,7 +4167,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *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;
@@ -4190,18 +4182,11 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info)
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
@@ -4226,7 +4211,6 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info)
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,
@@ -4236,12 +4220,11 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info)
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));
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 55aec83..63e9e69 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -275,10 +275,6 @@ struct elf32_hppa_link_hash_table
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;
@@ -780,9 +776,9 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
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
@@ -995,19 +991,13 @@ elf32_hppa_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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");
@@ -1359,7 +1349,7 @@ elf32_hppa_check_relocs (bfd *abfd,
/* 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;
@@ -1973,7 +1963,7 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf)
{
/* 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;
}
@@ -2021,12 +2011,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
&& 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;
}
@@ -2042,7 +2032,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
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 */
@@ -2055,11 +2045,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
|| (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
@@ -2290,8 +2280,8 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -2327,8 +2317,8 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
}
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)
@@ -2348,9 +2338,9 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
/* 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;
@@ -2373,14 +2363,14 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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;
@@ -2390,7 +2380,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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"))
@@ -2399,7 +2389,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
/* 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
@@ -2461,7 +2451,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -3824,11 +3814,11 @@ elf32_hppa_relocate_section (bfd *output_bfd,
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;
@@ -3837,7 +3827,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
}
else
bfd_put_32 (output_bfd, relocation,
- htab->sgot->contents + off);
+ htab->etab.sgot->contents + off);
}
if (off >= (bfd_vma) -2)
@@ -3845,8 +3835,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
/* 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;
@@ -3915,11 +3905,11 @@ elf32_hppa_relocate_section (bfd *output_bfd,
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;
@@ -3930,10 +3920,10 @@ elf32_hppa_relocate_section (bfd *output_bfd,
{
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);
}
}
@@ -3951,8 +3941,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
&& 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;
@@ -4093,12 +4083,12 @@ elf32_hppa_relocate_section (bfd *output_bfd,
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;
@@ -4106,8 +4096,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
/* 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;
}
@@ -4171,9 +4161,9 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|| 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)
@@ -4181,26 +4171,26 @@ elf32_hppa_relocate_section (bfd *output_bfd,
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);
}
}
@@ -4212,9 +4202,9 @@ elf32_hppa_relocate_section (bfd *output_bfd,
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);
}
@@ -4226,8 +4216,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
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)
@@ -4236,12 +4226,12 @@ elf32_hppa_relocate_section (bfd *output_bfd,
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;
}
@@ -4259,8 +4249,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
/* 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;
}
@@ -4366,8 +4356,8 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
/* 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);
@@ -4381,9 +4371,9 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
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)
{
@@ -4401,8 +4391,8 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
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,
@@ -4423,13 +4413,13 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
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);
}
@@ -4514,7 +4504,7 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd,
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))
@@ -4549,19 +4539,19 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd,
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;
@@ -4571,7 +4561,7 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd,
/* 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)
@@ -4600,23 +4590,23 @@ elf32_hppa_finish_dynamic_sections (bfd *output_bfd,
->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))
{
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index 7427995..940fc9d 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -884,7 +884,7 @@ i370_elf_finish_dynamic_sections (bfd *output_bfd,
{
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");
@@ -897,7 +897,7 @@ i370_elf_finish_dynamic_sections (bfd *output_bfd,
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;
@@ -905,35 +905,39 @@ i370_elf_finish_dynamic_sections (bfd *output_bfd,
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);
}
}
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index 3729503..405768c 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -87,12 +87,7 @@ struct elf_lm32_link_hash_table
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;
@@ -106,9 +101,9 @@ struct elf_lm32_link_hash_table
== 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)
@@ -197,36 +192,6 @@ _lm32fdpic_add_rofixup (bfd *output_bfd, asection *rofixup, bfd_vma relocation)
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. */
@@ -823,17 +788,15 @@ lm32_elf_relocate_section (bfd *output_bfd,
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);
@@ -1029,8 +992,7 @@ lm32_elf_relocate_section (bfd *output_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
@@ -1314,7 +1276,7 @@ lm32_elf_check_relocs (bfd *abfd,
}
/* Some relocs require a global offset table. */
- if (htab->sgot == NULL)
+ if (htab->root.sgot == NULL)
{
switch (r_type)
{
@@ -1323,7 +1285,7 @@ lm32_elf_check_relocs (bfd *abfd,
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;
}
@@ -1339,7 +1301,7 @@ lm32_elf_check_relocs (bfd *abfd,
(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)
@@ -1426,7 +1388,7 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd,
dynobj = htab->root.dynobj;
- sgot = htab->sgotplt;
+ sgot = htab->root.sgotplt;
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created)
@@ -1452,17 +1414,17 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd,
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;
@@ -1477,9 +1439,9 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd,
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);
@@ -1488,7 +1450,7 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd,
}
/* 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))
@@ -1614,9 +1576,9 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd,
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
@@ -1675,8 +1637,8 @@ lm32_elf_finish_dynamic_symbol (bfd *output_bfd,
/* 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
@@ -1930,7 +1892,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
- asection *s = htab->splt;
+ asection *s = htab->root.splt;
/* If this is the first .plt entry, make room for the special
first entry. */
@@ -1956,10 +1918,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* 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
{
@@ -1987,13 +1949,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
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;
@@ -2191,8 +2153,8 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
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)
@@ -2219,9 +2181,9 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
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
@@ -2229,7 +2191,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
}
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
@@ -2284,7 +2246,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
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)
@@ -2429,7 +2391,8 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
}
/* 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
@@ -2461,7 +2424,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
/* 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))
{
@@ -2482,7 +2445,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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;
@@ -2513,13 +2476,13 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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)
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c
index 44fcc24..c49de84 100644
--- a/bfd/elf32-m32c.c
+++ b/bfd/elf32-m32c.c
@@ -400,17 +400,13 @@ m32c_elf_relocate_section
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 ++)
{
@@ -704,20 +700,18 @@ m32c_elf_check_relocs
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)
@@ -759,14 +753,13 @@ static bfd_boolean
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;
@@ -794,7 +787,7 @@ m32c_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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);
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 4cf5b56..9d14925 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1523,11 +1523,6 @@ struct elf_m32r_link_hash_table
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;
@@ -1606,30 +1601,6 @@ m32r_elf_link_hash_table_create (bfd *abfd)
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
@@ -1658,7 +1629,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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;
@@ -1689,13 +1660,13 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
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)
@@ -1962,7 +1933,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
{
- asection *s = htab->splt;
+ asection *s = htab->root.splt;
/* If this is the first .plt entry, make room for the special
first entry. */
@@ -1988,10 +1959,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
/* 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
{
@@ -2019,13 +1990,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
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;
@@ -2227,8 +2198,8 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -2255,9 +2226,9 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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
@@ -2265,7 +2236,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
}
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
@@ -2320,7 +2291,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -2404,7 +2375,6 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
/* 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);
@@ -2412,11 +2382,10 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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;
@@ -2792,8 +2761,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
/* 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
@@ -3134,9 +3102,9 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
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
@@ -3230,8 +3198,8 @@ m32r_elf_finish_dynamic_symbol (bfd *output_bfd,
/* 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
@@ -3322,7 +3290,7 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
dynobj = htab->root.dynobj;
- sgot = htab->sgotplt;
+ sgot = htab->root.sgotplt;
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created)
@@ -3348,17 +3316,17 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
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;
@@ -3373,9 +3341,9 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
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);
@@ -3384,7 +3352,7 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
}
/* 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))
@@ -3760,7 +3728,7 @@ m32r_elf_check_relocs (bfd *abfd,
}
/* Some relocs require a global offset table. */
- if (htab->sgot == NULL)
+ if (htab->root.sgot == NULL)
{
switch (r_type)
{
@@ -3778,7 +3746,7 @@ m32r_elf_check_relocs (bfd *abfd,
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;
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 7c2e0fc..58df4c9 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -2434,7 +2434,7 @@ elf_m68k_partition_multi_got (struct bfd_link_info *info)
{
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
@@ -2443,7 +2443,7 @@ elf_m68k_partition_multi_got (struct bfd_link_info *info)
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
@@ -2557,8 +2557,6 @@ elf_m68k_check_relocs (bfd *abfd,
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;
@@ -2569,8 +2567,6 @@ elf_m68k_check_relocs (bfd *abfd,
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
- sgot = NULL;
- srelgot = NULL;
sreloc = NULL;
got = NULL;
@@ -2642,30 +2638,6 @@ elf_m68k_check_relocs (bfd *abfd,
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;
@@ -3105,7 +3077,7 @@ elf_m68k_adjust_dynamic_symbol (struct bfd_link_info *info,
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
@@ -3148,7 +3120,7 @@ elf_m68k_adjust_dynamic_symbol (struct bfd_link_info *info,
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
@@ -3175,12 +3147,12 @@ elf_m68k_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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);
@@ -3280,7 +3252,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
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;
}
@@ -3617,7 +3589,6 @@ elf_m68k_relocate_section (bfd *output_bfd,
Elf_Internal_Sym *local_syms,
asection **local_sections)
{
- bfd *dynobj;
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
asection *sgot;
@@ -3628,7 +3599,6 @@ elf_m68k_relocate_section (bfd *output_bfd,
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);
@@ -3706,21 +3676,16 @@ elf_m68k_relocate_section (bfd *output_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)
{
@@ -3781,11 +3746,8 @@ elf_m68k_relocate_section (bfd *output_bfd,
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)
{
@@ -3854,11 +3816,8 @@ elf_m68k_relocate_section (bfd *output_bfd,
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,
@@ -3959,11 +3918,8 @@ elf_m68k_relocate_section (bfd *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
@@ -3978,11 +3934,8 @@ elf_m68k_relocate_section (bfd *output_bfd,
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;
@@ -4260,9 +4213,9 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd,
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
@@ -4327,8 +4280,8 @@ elf_m68k_finish_dynamic_symbol (bfd *output_bfd,
/* This symbol has an entry in the global offset table. Set it
up. */
- sgot = bfd_get_linker_section (dy[...]
[diff truncated at 100000 bytes]