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