diff options
author | Alan Modra <amodra@gmail.com> | 2016-12-26 00:21:06 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2016-12-26 13:42:20 +1030 |
commit | 9d19e4fdb7c684329c8b1b72796a0071708dabc7 (patch) | |
tree | 6c02fe281d104a002db0c2a28ba7d9c1ddbd43b5 /bfd/elfxx-mips.c | |
parent | 09a1b0e9437f4e6c868b47322a84193a5ae3a391 (diff) | |
download | gdb-9d19e4fdb7c684329c8b1b72796a0071708dabc7.zip gdb-9d19e4fdb7c684329c8b1b72796a0071708dabc7.tar.gz gdb-9d19e4fdb7c684329c8b1b72796a0071708dabc7.tar.bz2 |
Put .dynbss and .rel.bss shortcuts in main elf hash table
Also, create .rel{,a}.bss for PIEs on all targets, not just x86.
* elf-bfd.h (struct elf_link_hash_table): Add sdynbss and srelbss.
* elflink.c (_bfd_elf_create_dynamic_sections): Set them. Create
.rel.bss/.rela.bss for executables, both PIE and non-PIE.
* elf32-arc.c (struct elf_arc_link_hash_table): Delete srelbss.
Use ELF hash table var throughout.
* elf32-arm.c (struct elf32_arm_link_hash_table): Delete sdynbss
and srelbss. Use ELF hash table vars throughout.
* elf32-hppa.c (struct elf32_hppa_link_hash_table): Likewise.
* elf32-i386.c (struct elf_i386_link_hash_table): Likewise.
* elf32-metag.c (struct elf_metag_link_hash_table): Likewise.
* elf32-microblaze.c (struct elf32_mb_link_hash_table): Likewise.
* elf32-nios2.c (struct elf32_nios2_link_hash_table): Likewise.
* elf32-or1k.c (struct elf_or1k_link_hash_table): Likewise.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Likewise.
* elf32-s390.c (struct elf_s390_link_hash_table): Likewise.
* elf32-tic6x.c (struct elf32_tic6x_link_hash_table): Likewise.
* elf32-tilepro.c (struct tilepro_elf_link_hash_table): Likewise.
* elf64-ppc.c (struct ppc_link_hash_table): Likewise.
* elf64-s390.c (struct elf_s390_link_hash_table): Likewise.
* elf64-x86-64.c (struct elf_x86_64_link_hash_table): Likewise.
* elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Likewise.
* elfnn-riscv.c (struct riscv_elf_link_hash_table): Likewise.
* elfxx-mips.c (struct mips_elf_link_hash_table): Likewise.
* elfxx-sparc.h (struct _bfd_sparc_elf_link_hash_table): Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c (struct tilegx_elf_link_hash_table): Likewise.
* elf32-arc.c (arc_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-microblaze.c (microblaze_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-or1k.c (or1k_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-s390.c (elf_s390_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf64-ppc.c (ppc64_elf_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf64-s390.c (elf_s390_create_dynamic_sections): Delete.
(elf_backend_create_dynamic_sections): Use base ELF version.
* elf32-tilepro.c (tilepro_elf_create_dynamic_sections): Remove
extraneous tests.
* elfnn-aarch64.c (elfNN_aarch64_create_dynamic_sections): Likewise.
* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Likewise.
* elfxx-tilegx.c (tilegx_elf_create_dynamic_sections): Likewise.
* elf32-i386.c (elf_i386_create_dynamic_sections): Don't create
".rel.bss" for executables.
* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't create
".rela.bss" for executables.
* elf32-nios2.c (nios2_elf32_create_dynamic_sections): Don't
ignore return status from _bfd_elf_create_dynamic_sections.
Diffstat (limited to 'bfd/elfxx-mips.c')
-rw-r--r-- | bfd/elfxx-mips.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 486607c..086d537 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -451,8 +451,6 @@ struct mips_elf_link_hash_table /* Shortcuts to some dynamic sections, or NULL if they are not being used. */ - asection *srelbss; - asection *sdynbss; asection *srelplt2; asection *sstubs; @@ -7893,16 +7891,6 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) if (!_bfd_elf_create_dynamic_sections (abfd, info)) return FALSE; - /* Cache the sections created above. */ - htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss"); - if (htab->is_vxworks) - htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss"); - if (!htab->sdynbss - || (htab->is_vxworks && !htab->srelbss && !bfd_link_pic (info)) - || !htab->root.srelplt - || !htab->root.splt) - abort (); - /* Do the usual VxWorks handling. */ if (htab->is_vxworks && !elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2)) @@ -9386,7 +9374,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { if (htab->is_vxworks) - htab->srelbss->size += sizeof (Elf32_External_Rela); + htab->root.srelbss->size += sizeof (Elf32_External_Rela); else mips_elf_allocate_dynamic_relocations (dynobj, info, 1); h->needs_copy = 1; @@ -9396,7 +9384,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, dynamic will now refer to the local copy instead. */ hmips->possibly_dynamic_relocs = 0; - return _bfd_elf_adjust_dynamic_copy (info, h, htab->sdynbss); + return _bfd_elf_adjust_dynamic_copy (info, h, htab->root.sdynbss); } /* This function is called after all the input files have been read, @@ -9918,7 +9906,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, && s != htab->root.sgot && s != htab->root.sgotplt && s != htab->sstubs - && s != htab->sdynbss) + && s != htab->root.sdynbss) { /* It's not one of our sections, so don't allocate space. */ continue; @@ -11317,10 +11305,10 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_COPY); rel.r_addend = 0; bfd_elf32_swap_reloca_out (output_bfd, &rel, - htab->srelbss->contents - + (htab->srelbss->reloc_count + htab->root.srelbss->contents + + (htab->root.srelbss->reloc_count * sizeof (Elf32_External_Rela))); - ++htab->srelbss->reloc_count; + ++htab->root.srelbss->reloc_count; } /* If this is a mips16/microMIPS symbol, force the value to be even. */ |