From: H.J. Lu Date: Tue, 2 Jun 2020 01:18:43 +0000 (-0700) Subject: ELF: Move dyn_relocs to struct elf_link_hash_entry X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=190eb1ddba41aad3a31edead9392473ae9d3bbe3;p=binutils-gdb.git ELF: Move dyn_relocs to struct elf_link_hash_entry All ELF backends with shared library support have /* Track dynamic relocs copied for this symbol. */ struct elf_dyn_relocs *dyn_relocs; in symbol hash entry. Move dyn_relocs to struct elf_link_hash_entry to reduce code duplication. PR ld/26067 * elf-bfd.h (elf_link_hash_entry): Add dyn_relocs after size. * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs): Updated. * elf32-arc.c (elf_arc_link_hash_entry): Remove dyn_relocs. (elf_arc_link_hash_newfunc): Updated. * elf32-arm.c (elf32_arm_link_hash_entry): Remove dyn_relocs. (elf32_arm_link_hash_newfunc): Updated. (elf32_arm_copy_indirect_symbol): Likewise. (elf32_arm_check_relocs): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs_for_symbol): Likewise. * elf32-csky.c (csky_elf_link_hash_entry): Remove dyn_relocs. (csky_elf_link_hash_newfunc): Updated. (csky_allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. (csky_elf_copy_indirect_symbol): Likewise. * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove dyn_relocs. (hppa_link_hash_newfunc): Updated. (elf32_hppa_copy_indirect_symbol): Likewise. (elf32_hppa_hide_symbol): Likewise. (elf32_hppa_adjust_dynamic_symbol): Likewise. (allocate_dynrelocs): Likewise. (elf32_hppa_relocate_section): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-lm32.c (elf_lm32_link_hash_entry): Removed. (lm32_elf_link_hash_newfunc): Likewise. (lm32_elf_link_hash_table_create): Updated. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. (lm32_elf_copy_indirect_symbol): Likewise. * elf32-m32r.c (elf_m32r_link_hash_entry): Removed. (m32r_elf_link_hash_newfunc): Likewise. (m32r_elf_link_hash_table_create): Updated. (m32r_elf_copy_indirect_symbol): Likewise. (allocate_dynrelocs): Likewise. * elf32-metag.c (elf_metag_link_hash_entry): Remove dyn_relocs. (metag_link_hash_newfunc): Updated. (elf_metag_copy_indirect_symbol): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. * elf32-microblaze.c (elf32_mb_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (microblaze_elf_check_relocs): Likewise. (microblaze_elf_copy_indirect_symbol): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. * elf32-nds32.c (elf_nds32_link_hash_entry): Remove dyn_relocs. (nds32_elf_link_hash_newfunc): Updated. (nds32_elf_copy_indirect_symbol): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. (nds32_elf_check_relocs): Likewise. * elf32-nios2.c (elf32_nios2_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (nios2_elf32_copy_indirect_symbol): Likewise. (nios2_elf32_check_relocs): Likewise. (allocate_dynrelocs): Likewise. * elf32-or1k.c (elf_or1k_link_hash_entry): Remove dyn_relocs. (or1k_elf_link_hash_newfunc): Updated. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. (or1k_elf_copy_indirect_symbol): Likewise. * elf32-ppc.c (ppc_elf_link_hash_entry): Remove dyn_relocs. (ppc_elf_link_hash_newfunc): Updated. (ppc_elf_copy_indirect_symbol): Likewise. (ppc_elf_check_relocs): Likewise. (readonly_dynrelocs): Likewise. (ppc_elf_adjust_dynamic_symbol): Likewise. (allocate_dynrelocs): Likewise. (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (elf_s390_copy_indirect_symbol): Likewise. (readonly_dynrelocs): Likewise. (elf_s390_adjust_dynamic_symbol): Likewise. (allocate_dynrelocs): Likewise. * elf32-sh.c (elf_sh_link_hash_entry): Remove dyn_relocs. (sh_elf_link_hash_newfunc): Updated. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. (sh_elf_copy_indirect_symbol): Likewise. (sh_elf_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_link_hash_entry): Removed. (elf32_tic6x_link_hash_newfunc): Likewise. (elf32_tic6x_link_hash_table_create): Updated. (readonly_dynrelocs): Likewise. (elf32_tic6x_check_relocs): Likewise. (elf32_tic6x_allocate_dynrelocs): Likewise. * elf32-tilepro.c (tilepro_elf_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (tilepro_elf_copy_indirect_symbol): Likewise. (tilepro_elf_check_relocs): Likewise. (allocate_dynrelocs): Likewise. * elf64-ppc.c (ppc_link_hash_entry): Remove dyn_relocs. (ppc64_elf_copy_indirect_symbol): Updated. (ppc64_elf_check_relocs): Likewise. (readonly_dynrelocs): Likewise. (ppc64_elf_adjust_dynamic_symbol): Likewise. (dec_dynrel_count): Likewise. (allocate_dynrelocs): Likewise. (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (elf_s390_copy_indirect_symbol): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elfnn-aarch64.c (elf_aarch64_link_hash_entry): Remove dyn_relocs. (elfNN_aarch64_link_hash_newfunc): Updated. (elfNN_aarch64_copy_indirect_symbol): Likewise. (readonly_dynrelocs): Likewise. (need_copy_relocation_p): Likewise. (elfNN_aarch64_allocate_dynrelocs): Likewise. (elfNN_aarch64_allocate_ifunc_dynrelocs): Likewise. * elfnn-riscv.c (riscv_elf_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (riscv_elf_copy_indirect_symbol): Likewise. (riscv_elf_check_relocs): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (_bfd_sparc_elf_copy_indirect_symbol): Likewise. (_bfd_sparc_elf_check_relocs): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. * elfxx-tilegx.c (tilegx_elf_link_hash_entry): Remove dyn_relocs. (link_hash_newfunc): Updated. (tilegx_elf_copy_indirect_symbol): Likewise. (tilegx_elf_check_relocs): Likewise. (readonly_dynrelocs): Likewise. (allocate_dynrelocs): Likewise. * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise. (readonly_dynrelocs): Likewise. (_bfd_x86_elf_copy_indirect_symbol): Likewise. * elfxx-x86.h (elf_x86_link_hash_entry): Remove dyn_relocs. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d4d4c4565b0..a3e777e990d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,147 @@ +2020-06-01 H.J. Lu + + PR ld/26067 + * elf-bfd.h (elf_link_hash_entry): Add dyn_relocs after size. + * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs): + Updated. + * elf32-arc.c (elf_arc_link_hash_entry): Remove dyn_relocs. + (elf_arc_link_hash_newfunc): Updated. + * elf32-arm.c (elf32_arm_link_hash_entry): Remove dyn_relocs. + (elf32_arm_link_hash_newfunc): Updated. + (elf32_arm_copy_indirect_symbol): Likewise. + (elf32_arm_check_relocs): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs_for_symbol): Likewise. + * elf32-csky.c (csky_elf_link_hash_entry): Remove dyn_relocs. + (csky_elf_link_hash_newfunc): Updated. + (csky_allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + (csky_elf_copy_indirect_symbol): Likewise. + * elf32-hppa.c (elf32_hppa_link_hash_entry): Remove dyn_relocs. + (hppa_link_hash_newfunc): Updated. + (elf32_hppa_copy_indirect_symbol): Likewise. + (elf32_hppa_hide_symbol): Likewise. + (elf32_hppa_adjust_dynamic_symbol): Likewise. + (allocate_dynrelocs): Likewise. + (elf32_hppa_relocate_section): Likewise. + * elf32-i386.c (elf_i386_check_relocs): Likewise. + * elf32-lm32.c (elf_lm32_link_hash_entry): Removed. + (lm32_elf_link_hash_newfunc): Likewise. + (lm32_elf_link_hash_table_create): Updated. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + (lm32_elf_copy_indirect_symbol): Likewise. + * elf32-m32r.c (elf_m32r_link_hash_entry): Removed. + (m32r_elf_link_hash_newfunc): Likewise. + (m32r_elf_link_hash_table_create): Updated. + (m32r_elf_copy_indirect_symbol): Likewise. + (allocate_dynrelocs): Likewise. + * elf32-metag.c (elf_metag_link_hash_entry): Remove dyn_relocs. + (metag_link_hash_newfunc): Updated. + (elf_metag_copy_indirect_symbol): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + * elf32-microblaze.c (elf32_mb_link_hash_entry): Remove + dyn_relocs. + (link_hash_newfunc): Updated. + (microblaze_elf_check_relocs): Likewise. + (microblaze_elf_copy_indirect_symbol): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + * elf32-nds32.c (elf_nds32_link_hash_entry): Remove dyn_relocs. + (nds32_elf_link_hash_newfunc): Updated. + (nds32_elf_copy_indirect_symbol): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + (nds32_elf_check_relocs): Likewise. + * elf32-nios2.c (elf32_nios2_link_hash_entry): Remove dyn_relocs. + (link_hash_newfunc): Updated. + (nios2_elf32_copy_indirect_symbol): Likewise. + (nios2_elf32_check_relocs): Likewise. + (allocate_dynrelocs): Likewise. + * elf32-or1k.c (elf_or1k_link_hash_entry): Remove dyn_relocs. + (or1k_elf_link_hash_newfunc): Updated. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + (or1k_elf_copy_indirect_symbol): Likewise. + * elf32-ppc.c (ppc_elf_link_hash_entry): Remove dyn_relocs. + (ppc_elf_link_hash_newfunc): Updated. + (ppc_elf_copy_indirect_symbol): Likewise. + (ppc_elf_check_relocs): Likewise. + (readonly_dynrelocs): Likewise. + (ppc_elf_adjust_dynamic_symbol): Likewise. + (allocate_dynrelocs): Likewise. + (ppc_elf_relocate_section): Likewise. + * elf32-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs. + (link_hash_newfunc): Updated. + (elf_s390_copy_indirect_symbol): Likewise. + (readonly_dynrelocs): Likewise. + (elf_s390_adjust_dynamic_symbol): Likewise. + (allocate_dynrelocs): Likewise. + * elf32-sh.c (elf_sh_link_hash_entry): Remove dyn_relocs. + (sh_elf_link_hash_newfunc): Updated. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + (sh_elf_copy_indirect_symbol): Likewise. + (sh_elf_check_relocs): Likewise. + * elf32-tic6x.c (elf32_tic6x_link_hash_entry): Removed. + (elf32_tic6x_link_hash_newfunc): Likewise. + (elf32_tic6x_link_hash_table_create): Updated. + (readonly_dynrelocs): Likewise. + (elf32_tic6x_check_relocs): Likewise. + (elf32_tic6x_allocate_dynrelocs): Likewise. + * elf32-tilepro.c (tilepro_elf_link_hash_entry): Remove + dyn_relocs. + (link_hash_newfunc): Updated. + (tilepro_elf_copy_indirect_symbol): Likewise. + (tilepro_elf_check_relocs): Likewise. + (allocate_dynrelocs): Likewise. + * elf64-ppc.c (ppc_link_hash_entry): Remove dyn_relocs. + (ppc64_elf_copy_indirect_symbol): Updated. + (ppc64_elf_check_relocs): Likewise. + (readonly_dynrelocs): Likewise. + (ppc64_elf_adjust_dynamic_symbol): Likewise. + (dec_dynrel_count): Likewise. + (allocate_dynrelocs): Likewise. + (ppc64_elf_relocate_section): Likewise. + * elf64-s390.c (elf_s390_link_hash_entry): Remove dyn_relocs. + (link_hash_newfunc): Updated. + (elf_s390_copy_indirect_symbol): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. + * elfnn-aarch64.c (elf_aarch64_link_hash_entry): Remove + dyn_relocs. + (elfNN_aarch64_link_hash_newfunc): Updated. + (elfNN_aarch64_copy_indirect_symbol): Likewise. + (readonly_dynrelocs): Likewise. + (need_copy_relocation_p): Likewise. + (elfNN_aarch64_allocate_dynrelocs): Likewise. + (elfNN_aarch64_allocate_ifunc_dynrelocs): Likewise. + * elfnn-riscv.c (riscv_elf_link_hash_entry): Remove dyn_relocs. + (link_hash_newfunc): Updated. + (riscv_elf_copy_indirect_symbol): Likewise. + (riscv_elf_check_relocs): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_link_hash_entry): Remove + dyn_relocs. + (link_hash_newfunc): Updated. + (_bfd_sparc_elf_copy_indirect_symbol): Likewise. + (_bfd_sparc_elf_check_relocs): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + * elfxx-tilegx.c (tilegx_elf_link_hash_entry): Remove dyn_relocs. + (link_hash_newfunc): Updated. + (tilegx_elf_copy_indirect_symbol): Likewise. + (tilegx_elf_check_relocs): Likewise. + (readonly_dynrelocs): Likewise. + (allocate_dynrelocs): Likewise. + * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise. + (readonly_dynrelocs): Likewise. + (_bfd_x86_elf_copy_indirect_symbol): Likewise. + * elfxx-x86.h (elf_x86_link_hash_entry): Remove dyn_relocs. + 2020-06-01 Alan Modra * vms-alpha.c (_bfd_vms_slurp_etir): Check bound for the current diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index e69234d2dde..a979ad3f7b6 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -156,9 +156,13 @@ struct elf_link_hash_entry /* Same, but tracks a procedure linkage table entry. */ union gotplt_union plt; - /* Symbol size. */ + /* Symbol size. NB: All fields starting from here are cleared by + _bfd_elf_link_hash_newfunc. */ bfd_size_type size; + /* Track dynamic relocs copied for this symbol. */ + struct elf_dyn_relocs *dyn_relocs; + /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */ unsigned int type : 8; diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c index dd318b0235f..ebe881fcb6e 100644 --- a/bfd/elf-s390-common.c +++ b/bfd/elf-s390-common.c @@ -170,7 +170,7 @@ s390_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info, struct elf_dyn_relocs *p; struct elf_link_hash_table *htab; struct elf_s390_link_hash_entry *eh = (struct elf_s390_link_hash_entry*)h; - struct elf_dyn_relocs **head = &eh->dyn_relocs; + struct elf_dyn_relocs **head = &h->dyn_relocs; htab = elf_hash_table (info); eh->ifunc_resolver_address = h->root.u.def.value; diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index 5429a462da0..774d3e793db 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -184,9 +184,6 @@ struct elf_arc_link_hash_entry { struct elf_link_hash_entry root; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - struct got_entry *got_ents; }; @@ -340,7 +337,6 @@ elf_arc_link_hash_newfunc (struct bfd_hash_entry *entry, table, string)); if (ret != NULL) { - ret->dyn_relocs = NULL; ret->got_ents = NULL; } diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 927a527a6e5..f31eb8c9c70 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3215,9 +3215,6 @@ struct elf32_arm_link_hash_entry { struct elf_link_hash_entry root; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* ARM-specific PLT information. */ struct arm_plt_info plt; @@ -3582,7 +3579,6 @@ elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry, table, string)); if (ret != NULL) { - ret->dyn_relocs = NULL; ret->tls_type = GOT_UNKNOWN; ret->tlsdesc_got = (bfd_vma) -1; ret->plt.thumb_refcount = 0; @@ -4032,20 +4028,20 @@ elf32_arm_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf32_arm_link_hash_entry *) dir; eind = (struct elf32_arm_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -4056,11 +4052,11 @@ elf32_arm_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect) @@ -15714,7 +15710,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct elf32_arm_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { head = elf32_arm_get_local_dynreloc_list (abfd, r_symndx, isym); @@ -16100,7 +16096,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = elf32_arm_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -16595,7 +16591,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) h->root.u.def.value = th->root.u.def.value & ~1; } - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -16616,7 +16612,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -16631,7 +16627,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { if (strcmp (p->sec->output_section->name, ".tls_vars") == 0) *pp = p->next; @@ -16642,12 +16638,12 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -16698,13 +16694,13 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 06ea26632d1..4be7ea8aa60 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -1163,8 +1163,6 @@ struct csky_elf_link_hash_entry int plt_refcount; /* For sub jsri2bsr relocs count. */ int jsri2bsr_refcount; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; #define GOT_UNKNOWN 0 #define GOT_NORMAL 1 @@ -1429,7 +1427,6 @@ csky_elf_link_hash_newfunc (struct bfd_hash_entry * entry, struct csky_elf_link_hash_entry *eh; eh = (struct csky_elf_link_hash_entry *) ret; - eh->dyn_relocs = NULL; eh->plt_refcount = 0; eh->jsri2bsr_refcount = 0; eh->tls_type = GOT_NORMAL; @@ -1804,7 +1801,7 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) h->got.offset = (bfd_vma) -1; eh = (struct csky_elf_link_hash_entry *) h; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -1819,7 +1816,7 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -1832,17 +1829,17 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) if (eh->jsri2bsr_refcount && h->root.type == bfd_link_hash_defined - && eh->dyn_relocs != NULL) - eh->dyn_relocs->count -= eh->jsri2bsr_refcount; + && h->dyn_relocs != NULL) + h->dyn_relocs->count -= eh->jsri2bsr_refcount; /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -1881,13 +1878,13 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *srelgot = htab->elf.srelgot; srelgot->size += p->count * sizeof (Elf32_External_Rela); @@ -1901,7 +1898,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = csky_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2465,20 +2462,20 @@ csky_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct csky_elf_link_hash_entry *) dir; eind = (struct csky_elf_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -2489,10 +2486,10 @@ csky_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect && dir->got.refcount <= 0) @@ -2687,7 +2684,7 @@ csky_elf_check_relocs (bfd * abfd, || (ELF32_R_TYPE (rel->r_info) == R_CKCORE_PCREL_JSR_IMM11BY2)) eh->jsri2bsr_refcount += 1; - head = &eh->dyn_relocs; + head = &h->dyn_relocs; } else { diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 4b76f941adf..ef32ba75cde 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -231,10 +231,6 @@ struct elf32_hppa_link_hash_entry symbol. */ struct elf32_hppa_stub_hash_entry *hsh_cache; - /* Used to count relocations for delayed sizing of relocation - sections. */ - struct elf_dyn_relocs *dyn_relocs; - ENUM_BITFIELD (_tls_type) tls_type : 8; /* Set if this symbol is used by a plabel reloc. */ @@ -390,7 +386,6 @@ hppa_link_hash_newfunc (struct bfd_hash_entry *entry, /* Initialize the local fields. */ hh = hppa_elf_hash_entry (entry); hh->hsh_cache = NULL; - hh->dyn_relocs = NULL; hh->plabel = 0; hh->tls_type = GOT_UNKNOWN; } @@ -1045,21 +1040,21 @@ elf32_hppa_copy_indirect_symbol (struct bfd_link_info *info, hh_dir = hppa_elf_hash_entry (eh_dir); hh_ind = hppa_elf_hash_entry (eh_ind); - if (hh_ind->dyn_relocs != NULL + if (eh_ind->dyn_relocs != NULL && eh_ind->root.type == bfd_link_hash_indirect) { - if (hh_dir->dyn_relocs != NULL) + if (eh_dir->dyn_relocs != NULL) { struct elf_dyn_relocs **hdh_pp; struct elf_dyn_relocs *hdh_p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (hdh_pp = &hh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) + for (hdh_pp = &eh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) { struct elf_dyn_relocs *hdh_q; - for (hdh_q = hh_dir->dyn_relocs; + for (hdh_q = eh_dir->dyn_relocs; hdh_q != NULL; hdh_q = hdh_q->next) if (hdh_q->sec == hdh_p->sec) @@ -1074,11 +1069,11 @@ elf32_hppa_copy_indirect_symbol (struct bfd_link_info *info, if (hdh_q == NULL) hdh_pp = &hdh_p->next; } - *hdh_pp = hh_dir->dyn_relocs; + *hdh_pp = eh_dir->dyn_relocs; } - hh_dir->dyn_relocs = hh_ind->dyn_relocs; - hh_ind->dyn_relocs = NULL; + eh_dir->dyn_relocs = eh_ind->dyn_relocs; + eh_ind->dyn_relocs = NULL; } if (eh_ind->root.type == bfd_link_hash_indirect) @@ -1494,7 +1489,7 @@ elf32_hppa_check_relocs (bfd *abfd, relocations we need for this symbol. */ if (hh != NULL) { - hdh_head = &hh->dyn_relocs; + hdh_head = &hh->eh.dyn_relocs; } else { @@ -1664,11 +1659,9 @@ elf32_hppa_hide_symbol (struct bfd_link_info *info, static asection * readonly_dynrelocs (struct elf_link_hash_entry *eh) { - struct elf32_hppa_link_hash_entry *hh; struct elf_dyn_relocs *hdh_p; - hh = hppa_elf_hash_entry (eh); - for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->next) + for (hdh_p = eh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->next) { asection *sec = hdh_p->sec->output_section; @@ -1719,7 +1712,7 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, /* Discard dyn_relocs when non-pic if we've decided that a function symbol is local. */ if (!bfd_link_pic (info) && local) - hppa_elf_hash_entry (eh)->dyn_relocs = NULL; + eh->dyn_relocs = NULL; /* If the symbol is used by a plabel, we must allocate a PLT slot. The refcounts are not reliable when it has been hidden since @@ -1769,7 +1762,7 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, eh->root.u.def.value = def->root.u.def.value; if (def->root.u.def.section == htab->etab.sdynbss || def->root.u.def.section == htab->etab.sdynrelro) - hppa_elf_hash_entry (eh)->dyn_relocs = NULL; + eh->dyn_relocs = NULL; return TRUE; } @@ -1827,7 +1820,7 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, } /* We no longer want dyn_relocs. */ - hppa_elf_hash_entry (eh)->dyn_relocs = NULL; + eh->dyn_relocs = NULL; return _bfd_elf_adjust_dynamic_copy (info, eh, sec); } @@ -2012,15 +2005,15 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) /* If no dynamic sections we can't have dynamic relocs. */ if (!htab->etab.dynamic_sections_created) - hh->dyn_relocs = NULL; + eh->dyn_relocs = NULL; /* Discard relocs on undefined syms with non-default visibility. */ else if ((eh->root.type == bfd_link_hash_undefined && ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT) || UNDEFWEAK_NO_DYNAMIC_RELOC (info, eh)) - hh->dyn_relocs = NULL; + eh->dyn_relocs = NULL; - if (hh->dyn_relocs == NULL) + if (eh->dyn_relocs == NULL) return TRUE; /* If this is a -Bsymbolic shared link, then we need to discard all @@ -2035,7 +2028,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) { struct elf_dyn_relocs **hdh_pp; - for (hdh_pp = &hh->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) + for (hdh_pp = &eh->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) { hdh_p->count -= hdh_p->pc_count; hdh_p->pc_count = 0; @@ -2047,7 +2040,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) } #endif - if (hh->dyn_relocs != NULL) + if (eh->dyn_relocs != NULL) { if (!ensure_undef_dynamic (info, eh)) return FALSE; @@ -2067,14 +2060,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) return FALSE; if (eh->dynindx == -1) - hh->dyn_relocs = NULL; + eh->dyn_relocs = NULL; } else - hh->dyn_relocs = NULL; + eh->dyn_relocs = NULL; } /* Finally, allocate space. */ - for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->next) + for (hdh_p = eh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->next) { asection *sreloc = elf_section_data (hdh_p->sec)->sreloc; sreloc->size += hdh_p->count * sizeof (Elf32_External_Rela); @@ -3909,11 +3902,11 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (bfd_link_pic (info) ? ((hh == NULL - || hh->dyn_relocs != NULL) + || hh->eh.dyn_relocs != NULL) && ((hh != NULL && pc_dynrelocs (hh)) || IS_ABSOLUTE_RELOC (r_type))) : (hh != NULL - && hh->dyn_relocs != NULL)) + && hh->eh.dyn_relocs != NULL)) { Elf_Internal_Rela outrel; bfd_boolean skip; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 51c3e863044..544b9315521 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1867,7 +1867,7 @@ elf_i386_check_relocs (bfd *abfd, relocations we need for this symbol. */ if (h != NULL) { - head = &eh->dyn_relocs; + head = &h->dyn_relocs; } else { diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 82c4fa0eef7..0fe09bf44a0 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -50,16 +50,6 @@ extern const bfd_target lm32_elf32_fdpic_vec; static bfd_reloc_status_type lm32_elf_gprel_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -/* lm32 ELF linker hash entry. */ - -struct elf_lm32_link_hash_entry -{ - struct elf_link_hash_entry root; - - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; -}; - /* lm32 ELF linker hash table. */ struct elf_lm32_link_hash_table @@ -93,39 +83,6 @@ struct weak_symbol_list struct weak_symbol_list *next; }; -/* Create an entry in an lm32 ELF linker hash table. */ - -static struct bfd_hash_entry * -lm32_elf_link_hash_newfunc (struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string) -{ - struct elf_lm32_link_hash_entry *ret = - (struct elf_lm32_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == NULL) - ret = bfd_hash_allocate (table, - sizeof (struct elf_lm32_link_hash_entry)); - if (ret == NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct elf_lm32_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != NULL) - { - struct elf_lm32_link_hash_entry *eh; - - eh = (struct elf_lm32_link_hash_entry *) ret; - eh->dyn_relocs = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - /* Create an lm32 ELF linker hash table. */ static struct bfd_link_hash_table * @@ -139,8 +96,8 @@ lm32_elf_link_hash_table_create (bfd *abfd) return NULL; if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, - lm32_elf_link_hash_newfunc, - sizeof (struct elf_lm32_link_hash_entry), + _bfd_elf_link_hash_newfunc, + sizeof (struct elf_link_hash_entry), LM32_ELF_DATA)) { free (ret); @@ -1648,9 +1605,8 @@ static asection * readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - struct elf_lm32_link_hash_entry *eh = (struct elf_lm32_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -1794,7 +1750,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct bfd_link_info *info; struct elf_lm32_link_hash_table *htab; - struct elf_lm32_link_hash_entry *eh; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -1805,8 +1760,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) if (htab == NULL) return FALSE; - eh = (struct elf_lm32_link_hash_entry *) h; - if (htab->root.dynamic_sections_created && h->plt.refcount > 0) { @@ -1889,7 +1842,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -1906,7 +1859,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL;) + for (pp = &h->dyn_relocs; (p = *pp) != NULL;) { p->count -= p->pc_count; p->pc_count = 0; @@ -1919,11 +1872,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -1963,13 +1916,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (Elf32_External_Rela); @@ -2461,26 +2414,20 @@ lm32_elf_copy_indirect_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *dir, struct elf_link_hash_entry *ind) { - struct elf_lm32_link_hash_entry * edir; - struct elf_lm32_link_hash_entry * eind; - - edir = (struct elf_lm32_link_hash_entry *) dir; - eind = (struct elf_lm32_link_hash_entry *) ind; - - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL;) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL;) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -2491,11 +2438,11 @@ lm32_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } _bfd_elf_link_hash_copy_indirect (info, dir, ind); diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 598fbe5633b..c147b713de3 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1498,16 +1498,6 @@ struct elf_m32r_pcrel_relocs_copied bfd_size_type count; }; -/* m32r ELF linker hash entry. */ - -struct elf_m32r_link_hash_entry -{ - struct elf_link_hash_entry root; - - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; -}; - /* m32r ELF linker hash table. */ struct elf_m32r_link_hash_table @@ -1536,39 +1526,6 @@ struct elf_m32r_link_hash_table (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \ == M32R_ELF_DATA ? ((struct elf_m32r_link_hash_table *) ((p)->hash)) : NULL) -/* Create an entry in an m32r ELF linker hash table. */ - -static struct bfd_hash_entry * -m32r_elf_link_hash_newfunc (struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string) -{ - struct elf_m32r_link_hash_entry *ret = - (struct elf_m32r_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == NULL) - ret = bfd_hash_allocate (table, - sizeof (struct elf_m32r_link_hash_entry)); - if (ret == NULL) - return NULL; - - /* Call the allocation method of the superclass. */ - ret = ((struct elf_m32r_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != NULL) - { - struct elf_m32r_link_hash_entry *eh; - - eh = (struct elf_m32r_link_hash_entry *) ret; - eh->dyn_relocs = NULL; - } - - return (struct bfd_hash_entry *) ret; -} - /* Create an m32r ELF linker hash table. */ static struct bfd_link_hash_table * @@ -1582,8 +1539,8 @@ m32r_elf_link_hash_table_create (bfd *abfd) return NULL; if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, - m32r_elf_link_hash_newfunc, - sizeof (struct elf_m32r_link_hash_entry), + _bfd_elf_link_hash_newfunc, + sizeof (struct elf_link_hash_entry), M32R_ELF_DATA)) { free (ret); @@ -1708,26 +1665,20 @@ m32r_elf_copy_indirect_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *dir, struct elf_link_hash_entry *ind) { - struct elf_m32r_link_hash_entry * edir; - struct elf_m32r_link_hash_entry * eind; - - edir = (struct elf_m32r_link_hash_entry *) dir; - eind = (struct elf_m32r_link_hash_entry *) ind; - - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL;) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL;) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -1738,11 +1689,11 @@ m32r_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } _bfd_elf_link_hash_copy_indirect (info, dir, ind); @@ -1755,9 +1706,8 @@ static asection * readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - struct elf_m32r_link_hash_entry *eh = (struct elf_m32r_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -1905,7 +1855,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct bfd_link_info *info; struct elf_m32r_link_hash_table *htab; - struct elf_m32r_link_hash_entry *eh; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -1916,8 +1865,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) if (htab == NULL) return FALSE; - eh = (struct elf_m32r_link_hash_entry *) h; - if (htab->root.dynamic_sections_created && h->plt.refcount > 0) { @@ -2000,7 +1947,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -2017,7 +1964,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL;) + for (pp = &h->dyn_relocs; (p = *pp) != NULL;) { p->count -= p->pc_count; p->pc_count = 0; @@ -2030,11 +1977,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -2074,13 +2021,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (Elf32_External_Rela); @@ -3751,7 +3698,7 @@ m32r_elf_check_relocs (bfd *abfd, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct elf_m32r_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. */ diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 44923edc7b4..bfd4b24f5f2 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -785,10 +785,6 @@ struct elf_metag_link_hash_entry symbol. */ struct elf_metag_stub_hash_entry *hsh_cache; - /* Used to count relocations for delayed sizing of relocation - sections. */ - struct elf_dyn_relocs *dyn_relocs; - enum { GOT_UNKNOWN = 0, GOT_NORMAL = 1, GOT_TLS_IE = 2, GOT_TLS_LDM = 4, GOT_TLS_GD = 8 @@ -994,7 +990,6 @@ metag_link_hash_newfunc (struct bfd_hash_entry *entry, /* Initialize the local fields. */ hh = (struct elf_metag_link_hash_entry *) entry; hh->hsh_cache = NULL; - hh->dyn_relocs = NULL; hh->tls_type = GOT_UNKNOWN; } @@ -2328,7 +2323,7 @@ elf_metag_check_relocs (bfd *abfd, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (hh != NULL) - hdh_head = &((struct elf_metag_link_hash_entry *) hh)->dyn_relocs; + hdh_head = &hh->eh.dyn_relocs; else { /* Track dynamic relocs needed for local syms too. */ @@ -2395,9 +2390,9 @@ elf_metag_copy_indirect_symbol (struct bfd_link_info *info, hh_dir = metag_elf_hash_entry (eh_dir); hh_ind = metag_elf_hash_entry (eh_ind); - if (hh_ind->dyn_relocs != NULL) + if (eh_ind->dyn_relocs != NULL) { - if (hh_dir->dyn_relocs != NULL) + if (eh_dir->dyn_relocs != NULL) { struct elf_dyn_relocs **hdh_pp; struct elf_dyn_relocs *hdh_p; @@ -2407,11 +2402,11 @@ elf_metag_copy_indirect_symbol (struct bfd_link_info *info, /* Add reloc counts against the weak sym to the strong sym list. Merge any entries against the same section. */ - for (hdh_pp = &hh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) + for (hdh_pp = &eh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) { struct elf_dyn_relocs *hdh_q; - for (hdh_q = hh_dir->dyn_relocs; hdh_q != NULL; + for (hdh_q = eh_dir->dyn_relocs; hdh_q != NULL; hdh_q = hdh_q->next) if (hdh_q->sec == hdh_p->sec) { @@ -2423,11 +2418,11 @@ elf_metag_copy_indirect_symbol (struct bfd_link_info *info, if (hdh_q == NULL) hdh_pp = &hdh_p->next; } - *hdh_pp = hh_dir->dyn_relocs; + *hdh_pp = eh_dir->dyn_relocs; } - hh_dir->dyn_relocs = hh_ind->dyn_relocs; - hh_ind->dyn_relocs = NULL; + eh_dir->dyn_relocs = eh_ind->dyn_relocs; + eh_ind->dyn_relocs = NULL; } if (eh_ind->root.type == bfd_link_hash_indirect @@ -2447,7 +2442,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = metag_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2580,7 +2575,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) { struct bfd_link_info *info; struct elf_metag_link_hash_table *htab; - struct elf_metag_link_hash_entry *hh; struct elf_dyn_relocs *hdh_p; if (eh->root.type == bfd_link_hash_indirect) @@ -2687,8 +2681,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) else eh->got.offset = (bfd_vma) -1; - hh = (struct elf_metag_link_hash_entry *) eh; - if (hh->dyn_relocs == NULL) + if (eh->dyn_relocs == NULL) return TRUE; /* If this is a -Bsymbolic shared link, then we need to discard all @@ -2702,7 +2695,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) { struct elf_dyn_relocs **hdh_pp; - for (hdh_pp = &hh->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) + for (hdh_pp = &eh->dyn_relocs; (hdh_p = *hdh_pp) != NULL; ) { hdh_p->count -= hdh_p->pc_count; hdh_p->pc_count = 0; @@ -2715,11 +2708,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (hh->dyn_relocs != NULL + if (eh->dyn_relocs != NULL && eh->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT) - hh->dyn_relocs = NULL; + eh->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -2758,14 +2751,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) goto keep; } - hh->dyn_relocs = NULL; + eh->dyn_relocs = NULL; return TRUE; keep: ; } /* Finally, allocate space. */ - for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->next) + for (hdh_p = eh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->next) { asection *sreloc = elf_section_data (hdh_p->sec)->sreloc; sreloc->size += hdh_p->count * sizeof (Elf32_External_Rela); diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index f88da8f6a0c..928098d2be2 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -721,9 +721,6 @@ struct elf32_mb_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* TLS Reference Types for the symbol; Updated by check_relocs */ #define TLS_GD 1 /* GD reloc. */ #define TLS_LD 2 /* LD reloc. */ @@ -790,7 +787,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct elf32_mb_link_hash_entry *eh; eh = (struct elf32_mb_link_hash_entry *) entry; - eh->dyn_relocs = NULL; eh->tls_mask = 0; } @@ -2516,7 +2512,7 @@ microblaze_elf_check_relocs (bfd * abfd, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct elf32_mb_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. @@ -2579,9 +2575,9 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf32_mb_link_hash_entry *) dir; eind = (struct elf32_mb_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; @@ -2591,11 +2587,11 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info, /* Add reloc counts against the weak sym to the strong sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -2606,11 +2602,11 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } edir->tls_mask |= eind->tls_mask; @@ -2625,7 +2621,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = elf32_mb_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2898,7 +2894,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -2915,7 +2911,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -2926,7 +2922,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat) } } else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; } else { @@ -2956,13 +2952,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (Elf32_External_Rela); diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 2d26e2ad85d..ee4eea7372f 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -199,9 +199,6 @@ struct elf_nds32_link_hash_entry { struct elf_link_hash_entry root; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* For checking relocation type. */ enum elf_nds32_tls_type tls_type; @@ -3669,7 +3666,6 @@ nds32_elf_link_hash_newfunc (struct bfd_hash_entry *entry, struct elf_nds32_link_hash_entry *eh; eh = (struct elf_nds32_link_hash_entry *) ret; - eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; eh->offset_to_gp = 0; } @@ -3878,9 +3874,9 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf_nds32_link_hash_entry *) dir; eind = (struct elf_nds32_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; @@ -3890,11 +3886,11 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info, /* Add reloc counts against the weak sym to the strong sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL;) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL;) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -3905,11 +3901,11 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect) @@ -3932,7 +3928,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = elf32_nds32_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -4094,7 +4090,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) struct bfd_link_info *info; struct elf_link_hash_table *ehtab; struct elf_nds32_link_hash_table *htab; - struct elf_nds32_link_hash_entry *eh; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -4106,16 +4101,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) if (h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; - eh = (struct elf_nds32_link_hash_entry *) h; - info = (struct bfd_link_info *) inf; ehtab = elf_hash_table (info); htab = nds32_elf_hash_table (info); if (htab == NULL) return FALSE; - eh = (struct elf_nds32_link_hash_entry *) h; - if ((htab->root.dynamic_sections_created || h->type == STT_GNU_IFUNC) && h->plt.refcount > 0 && !(bfd_link_pie (info) && h->def_regular)) @@ -4227,7 +4218,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else h->got.offset = (bfd_vma)-1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -4242,7 +4233,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL;) + for (pp = &h->dyn_relocs; (p = *pp) != NULL;) { p->count -= p->pc_count; p->pc_count = 0; @@ -4279,13 +4270,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep:; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (Elf32_External_Rela); @@ -7423,7 +7414,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct elf_nds32_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { asection *s; diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 0b2e68ebd69..6b4b092e2df 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -1737,9 +1737,6 @@ struct elf32_nios2_link_hash_entry symbol. */ struct elf32_nios2_stub_hash_entry *hsh_cache; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - #define GOT_UNKNOWN 0 #define GOT_NORMAL 1 #define GOT_TLS_GD 2 @@ -2039,7 +2036,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, eh = (struct elf32_nios2_link_hash_entry *) entry; eh->hsh_cache = NULL; - eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; eh->got_types_used = 0; } @@ -4641,20 +4637,20 @@ nios2_elf32_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf32_nios2_link_hash_entry *) dir; eind = (struct elf32_nios2_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -4665,11 +4661,11 @@ nios2_elf32_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect @@ -4926,7 +4922,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct elf32_nios2_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. @@ -5631,7 +5627,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -5647,7 +5643,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -5660,12 +5656,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -5700,13 +5696,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (Elf32_External_Rela); diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index a7fe0a9c7c5..7afde7a59a6 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -892,9 +892,6 @@ struct elf_or1k_link_hash_entry { struct elf_link_hash_entry root; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* Track type of TLS access. */ unsigned char tls_type; }; @@ -964,7 +961,6 @@ or1k_elf_link_hash_newfunc (struct bfd_hash_entry *entry, struct elf_or1k_link_hash_entry *eh; eh = (struct elf_or1k_link_hash_entry *) ret; - eh->dyn_relocs = NULL; eh->tls_type = TLS_UNKNOWN; } @@ -2153,7 +2149,7 @@ or1k_elf_check_relocs (bfd *abfd, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct elf_or1k_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. @@ -2557,9 +2553,8 @@ static asection * readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *sec_relocs; - struct elf_or1k_link_hash_entry *eh = (struct elf_or1k_link_hash_entry *) h; - for (sec_relocs = eh->dyn_relocs; + for (sec_relocs = h->dyn_relocs; sec_relocs != NULL; sec_relocs = sec_relocs->next) { @@ -2758,7 +2753,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct bfd_link_info *info; struct elf_or1k_link_hash_table *htab; - struct elf_or1k_link_hash_entry *eh; struct elf_dyn_relocs *sec_relocs; if (h->root.type == bfd_link_hash_indirect) @@ -2769,8 +2763,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) if (htab == NULL) return FALSE; - eh = (struct elf_or1k_link_hash_entry *) h; - if (htab->root.dynamic_sections_created && h->plt.refcount > 0) { @@ -2857,7 +2849,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -2872,7 +2864,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (sec_relocs = *pp) != NULL;) + for (pp = &h->dyn_relocs; (sec_relocs = *pp) != NULL;) { sec_relocs->count -= sec_relocs->pc_count; sec_relocs->pc_count = 0; @@ -2885,11 +2877,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -2929,13 +2921,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (sec_relocs = eh->dyn_relocs; + for (sec_relocs = h->dyn_relocs; sec_relocs != NULL; sec_relocs = sec_relocs->next) { @@ -3204,20 +3196,20 @@ or1k_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf_or1k_link_hash_entry *) dir; eind = (struct elf_or1k_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL;) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL;) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -3228,11 +3220,11 @@ or1k_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index d1c5e1b2248..eecb15f0bc1 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2116,9 +2116,6 @@ struct ppc_elf_link_hash_entry from the beginning of the section. */ elf_linker_section_pointers_t *linker_section_pointer; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* Contexts in which symbol is used in the GOT. Bits are or'd into the mask as the corresponding relocs are encountered during check_relocs, with TLS_TLS being set when any @@ -2264,7 +2261,6 @@ ppc_elf_link_hash_newfunc (struct bfd_hash_entry *entry, if (entry != NULL) { ppc_elf_hash_entry (entry)->linker_section_pointer = NULL; - ppc_elf_hash_entry (entry)->dyn_relocs = NULL; ppc_elf_hash_entry (entry)->tls_mask = 0; ppc_elf_hash_entry (entry)->has_sda_refs = 0; } @@ -2538,20 +2534,20 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info, if (eind->elf.root.type != bfd_link_hash_indirect) return; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -2562,11 +2558,11 @@ ppc_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } /* Copy over the GOT refcount entries that we may have already seen to @@ -3482,7 +3478,7 @@ ppc_elf_check_relocs (bfd *abfd, struct elf_dyn_relocs *p; struct elf_dyn_relocs **rel_head; - rel_head = &ppc_elf_hash_entry (h)->dyn_relocs; + rel_head = &h->dyn_relocs; p = *rel_head; if (p == NULL || p->sec != sec) { @@ -4705,7 +4701,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -4740,7 +4736,7 @@ pc_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) if (p->pc_count != 0) return TRUE; return FALSE; @@ -4784,7 +4780,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* Discard dyn_relocs when non-pic if we've decided that a function symbol is local. */ if (!bfd_link_pic (info) && local) - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Clear procedure linkage table information for any symbol that won't need a .plt entry. */ @@ -4841,7 +4837,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, else if (!bfd_link_pic (info)) /* We are going to be defining the function symbol on the plt stub, so no dyn_relocs needed when non-pic. */ - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; } h->protected_def = 0; /* Function symbols can't have copy relocs. */ @@ -4862,7 +4858,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (def->root.u.def.section == htab->elf.sdynbss || def->root.u.def.section == htab->elf.sdynrelro || def->root.u.def.section == htab->dynsbss) - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; return TRUE; } @@ -4958,7 +4954,7 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, } /* We no longer want dyn_relocs. */ - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; return _bfd_elf_adjust_dynamic_copy (info, h, s); } @@ -5168,19 +5164,19 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) IFUNCs which are handled even in static executables. */ if (!htab->elf.dynamic_sections_created && h->type != STT_GNU_IFUNC) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Discard relocs on undefined symbols that must be local. */ else if (h->root.type == bfd_link_hash_undefined && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Also discard relocs on undefined weak syms with non-default visibility, or when dynamic_undefined_weak says so. */ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) ; /* In the shared -Bsymbolic case, discard space allocated for @@ -5200,7 +5196,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -5215,7 +5211,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { if (strcmp (p->sec->output_section->name, ".tls_vars") == 0) *pp = p->next; @@ -5224,7 +5220,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } - if (eh->dyn_relocs != NULL) + if (h->dyn_relocs != NULL) { /* Make sure this symbol is output as a dynamic symbol. */ if (!ensure_undef_dynamic (info, h)) @@ -5249,14 +5245,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) return FALSE; if (h->dynindx == -1) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; } else - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; } /* Allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; if (eh->elf.type == STT_GNU_IFUNC) @@ -8111,11 +8107,11 @@ ppc_elf_relocate_section (bfd *output_bfd, if (bfd_link_pic (info) ? ((h == NULL - || ppc_elf_hash_entry (h)->dyn_relocs != NULL) + || h->dyn_relocs != NULL) && ((h != NULL && pc_dynrelocs (h)) || must_be_dyn_reloc (info, r_type))) : (h != NULL - && ppc_elf_hash_entry (h)->dyn_relocs != NULL)) + && h->dyn_relocs != NULL)) { int skip; bfd_byte *loc; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 9490b67b00b..c42ce5e83f5 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -654,9 +654,6 @@ struct elf_s390_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* Number of GOTPLT references for a function. */ bfd_signed_vma gotplt_refcount; @@ -787,7 +784,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct elf_s390_link_hash_entry *eh; eh = (struct elf_s390_link_hash_entry *) entry; - eh->dyn_relocs = NULL; eh->gotplt_refcount = 0; eh->tls_type = GOT_UNKNOWN; eh->ifunc_resolver_address = 0; @@ -832,20 +828,20 @@ elf_s390_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf_s390_link_hash_entry *) dir; eind = (struct elf_s390_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -856,11 +852,11 @@ elf_s390_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect @@ -1306,7 +1302,7 @@ elf_s390_check_relocs (bfd *abfd, relocations we need for this symbol. */ if (h != NULL) { - head = &((struct elf_s390_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; } else { @@ -1428,7 +1424,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = elf_s390_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -1460,11 +1456,9 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, { bfd_size_type pc_count = 0, count = 0; struct elf_dyn_relocs **pp; - struct elf_s390_link_hash_entry *eh; struct elf_dyn_relocs *p; - eh = (struct elf_s390_link_hash_entry *) h; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { pc_count += p->pc_count; p->count -= p->pc_count; @@ -1612,7 +1606,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct bfd_link_info *info; struct elf_s390_link_hash_table *htab; - struct elf_s390_link_hash_entry *eh = (struct elf_s390_link_hash_entry *)h; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -1743,7 +1736,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -1758,7 +1751,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -1771,12 +1764,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -1816,13 +1809,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 7daf8516c4b..ebce61c017c 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2095,9 +2095,6 @@ struct elf_sh_link_hash_entry { struct elf_link_hash_entry root; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - bfd_signed_vma gotplt_refcount; /* A local function descriptor, for FDPIC. The refcount counts @@ -2231,7 +2228,6 @@ sh_elf_link_hash_newfunc (struct bfd_hash_entry *entry, table, string)); if (ret != (struct elf_sh_link_hash_entry *) NULL) { - ret->dyn_relocs = NULL; ret->gotplt_refcount = 0; ret->funcdesc.refcount = 0; ret->abs_funcdesc_refcount = 0; @@ -2487,7 +2483,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = sh_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2842,7 +2838,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) htab->srelfuncdesc->size += sizeof (Elf32_External_Rela); } - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -2857,7 +2853,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -2872,7 +2868,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { if (strcmp (p->sec->output_section->name, ".tls_vars") == 0) *pp = p->next; @@ -2883,12 +2879,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -2928,13 +2924,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (Elf32_External_Rela); @@ -5324,20 +5320,20 @@ sh_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf_sh_link_hash_entry *) dir; eind = (struct elf_sh_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -5348,11 +5344,11 @@ sh_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } edir->gotplt_refcount = eind->gotplt_refcount; eind->gotplt_refcount = 0; @@ -5812,7 +5808,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct elf_sh_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. */ diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index 20e4324b096..5e0a7d04b70 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -61,16 +61,6 @@ struct elf32_tic6x_link_hash_table #define elf32_tic6x_hash_table(p) \ ((struct elf32_tic6x_link_hash_table *) ((p)->hash)) -/* TI C6X ELF linker hash entry. */ - -struct elf32_tic6x_link_hash_entry -{ - struct elf_link_hash_entry elf; - - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; -}; - typedef enum { DELETE_EXIDX_ENTRY, @@ -1559,36 +1549,6 @@ elf32_tic6x_set_use_rela_p (bfd *abfd, bfd_boolean use_rela_p) elf32_tic6x_tdata (abfd)->use_rela_p = use_rela_p; } -/* Create an entry in a C6X ELF linker hash table. */ - -static struct bfd_hash_entry * -elf32_tic6x_link_hash_newfunc (struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string) -{ - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (entry == NULL) - { - entry = bfd_hash_allocate (table, - sizeof (struct elf32_tic6x_link_hash_entry)); - if (entry == NULL) - return entry; - } - - /* Call the allocation method of the superclass. */ - entry = _bfd_elf_link_hash_newfunc (entry, table, string); - if (entry != NULL) - { - struct elf32_tic6x_link_hash_entry *eh; - - eh = (struct elf32_tic6x_link_hash_entry *) entry; - eh->dyn_relocs = NULL; - } - - return entry; -} - /* Create a C6X ELF linker hash table. */ static struct bfd_link_hash_table * @@ -1602,8 +1562,8 @@ elf32_tic6x_link_hash_table_create (bfd *abfd) return NULL; if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, - elf32_tic6x_link_hash_newfunc, - sizeof (struct elf32_tic6x_link_hash_entry), + _bfd_elf_link_hash_newfunc, + sizeof (struct elf_link_hash_entry), TIC6X_ELF_DATA)) { free (ret); @@ -2009,10 +1969,8 @@ static asection * readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - struct elf32_tic6x_link_hash_entry *eh - = (struct elf32_tic6x_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2924,7 +2882,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info, relocations we need for this symbol. */ if (h != NULL) { - head = &((struct elf32_tic6x_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; } else { @@ -3089,13 +3047,11 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct bfd_link_info *info; struct elf32_tic6x_link_hash_table *htab; - struct elf32_tic6x_link_hash_entry *eh; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) return TRUE; - eh = (struct elf32_tic6x_link_hash_entry *) h; info = (struct bfd_link_info *) inf; htab = elf32_tic6x_hash_table (info); @@ -3176,7 +3132,7 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* Discard relocs on undefined weak syms with non-default @@ -3189,7 +3145,7 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -3200,11 +3156,11 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -3218,7 +3174,7 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc; diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index f16f5851cf6..4b7446fa40c 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -685,9 +685,6 @@ struct tilepro_elf_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - #define GOT_UNKNOWN 0 #define GOT_NORMAL 1 #define GOT_TLS_GD 2 @@ -1176,7 +1173,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct tilepro_elf_link_hash_entry *eh; eh = (struct tilepro_elf_link_hash_entry *) entry; - eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; } @@ -1296,20 +1292,20 @@ tilepro_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct tilepro_elf_link_hash_entry *) dir; eind = (struct tilepro_elf_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -1320,11 +1316,11 @@ tilepro_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect @@ -1760,8 +1756,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = - &((struct tilepro_elf_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. @@ -1883,7 +1878,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = tilepro_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2025,7 +2020,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct bfd_link_info *info; struct tilepro_elf_link_hash_table *htab; - struct tilepro_elf_link_hash_entry *eh; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -2134,8 +2128,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else h->got.offset = (bfd_vma) -1; - eh = (struct tilepro_elf_link_hash_entry *) h; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -2150,7 +2143,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -2163,12 +2156,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -2208,13 +2201,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * TILEPRO_ELF_RELA_BYTES; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index bbd8aee4f96..5903217077d 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -3075,9 +3075,6 @@ struct ppc_link_hash_entry struct ppc_link_hash_entry *next_dot_sym; } u; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* Link between function code and descriptor symbols. */ struct ppc_link_hash_entry *oh; @@ -3906,20 +3903,20 @@ ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info, return; /* Copy over any dynamic relocs we may have on the indirect sym. */ - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -3930,11 +3927,11 @@ ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } /* Copy over got entries that we may have already seen to the @@ -5165,7 +5162,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, struct elf_dyn_relocs *p; struct elf_dyn_relocs **head; - head = &ppc_elf_hash_entry (h)->dyn_relocs; + head = &h->dyn_relocs; p = *head; if (p == NULL || p->sec != sec) { @@ -6364,10 +6361,9 @@ ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED, static asection * readonly_dynrelocs (struct elf_link_hash_entry *h) { - struct ppc_link_hash_entry *eh = ppc_elf_hash_entry (h); struct elf_dyn_relocs *p; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -6403,7 +6399,7 @@ pc_dynrelocs (struct ppc_link_hash_entry *eh) { struct elf_dyn_relocs *p; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = eh->elf.dyn_relocs; p != NULL; p = p->next) if (p->pc_count != 0) return TRUE; return FALSE; @@ -6466,7 +6462,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (!bfd_link_pic (info) && h->type != STT_GNU_IFUNC && local) - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Clear procedure linkage table information for any symbol that won't need a .plt entry. */ @@ -6507,7 +6503,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, else if (!bfd_link_pic (info)) /* We are going to be defining the function symbol on the plt stub, so no dyn_relocs needed when non-pic. */ - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; } /* ELFv2 function symbols can't have copy relocs. */ @@ -6537,7 +6533,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->root.u.def.value = def->root.u.def.value; if (def->root.u.def.section == htab->elf.sdynbss || def->root.u.def.section == htab->elf.sdynrelro) - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; return TRUE; } @@ -6627,7 +6623,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, } /* We no longer want dyn_relocs. */ - ppc_elf_hash_entry (h)->dyn_relocs = NULL; + h->dyn_relocs = NULL; return _bfd_elf_adjust_dynamic_copy (info, h, s); } @@ -7049,7 +7045,7 @@ dec_dynrel_count (bfd_vma r_info, { struct elf_dyn_relocs *p; struct elf_dyn_relocs **pp; - pp = &ppc_elf_hash_entry (h)->dyn_relocs; + pp = &h->dyn_relocs; /* elf_gc_sweep may have already removed all dyn relocs associated with local syms for a given section. Also, symbol flags are @@ -9630,19 +9626,19 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) IFUNCs which are handled even in static executables. */ if (!htab->elf.dynamic_sections_created && h->type != STT_GNU_IFUNC) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Discard relocs on undefined symbols that must be local. */ else if (h->root.type == bfd_link_hash_undefined && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Also discard relocs on undefined weak syms with non-default visibility, or when dynamic_undefined_weak says so. */ else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; - if (eh->dyn_relocs != NULL) + if (h->dyn_relocs != NULL) { struct elf_dyn_relocs *p, **pp; @@ -9662,7 +9658,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) avoid writing weird assembly. */ if (SYMBOL_CALLS_LOCAL (info, h)) { - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -9673,7 +9669,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } } - if (eh->dyn_relocs != NULL) + if (h->dyn_relocs != NULL) { /* Ensure we catch all the cases where this symbol should be made dynamic. */ @@ -9697,14 +9693,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* But if that didn't work out, discard dynamic relocs. */ if (h->dynindx == -1) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; } else - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; if (eh->elf.type == STT_GNU_IFUNC) @@ -16510,11 +16506,11 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (bfd_link_pic (info) ? ((h == NULL - || h->dyn_relocs != NULL) + || h->elf.dyn_relocs != NULL) && ((h != NULL && pc_dynrelocs (h)) || must_be_dyn_reloc (info, r_type))) : (h != NULL - ? h->dyn_relocs != NULL + ? h->elf.dyn_relocs != NULL : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)) { bfd_boolean skip, relocate; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 70fb68a0a2d..ec070ce4a33 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -571,9 +571,6 @@ struct elf_s390_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* Number of GOTPLT references for a function. */ bfd_signed_vma gotplt_refcount; @@ -706,7 +703,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct elf_s390_link_hash_entry *eh; eh = (struct elf_s390_link_hash_entry *) entry; - eh->dyn_relocs = NULL; eh->gotplt_refcount = 0; eh->tls_type = GOT_UNKNOWN; eh->ifunc_resolver_address = 0; @@ -751,20 +747,20 @@ elf_s390_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf_s390_link_hash_entry *) dir; eind = (struct elf_s390_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -775,11 +771,11 @@ elf_s390_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect @@ -1241,7 +1237,7 @@ elf_s390_check_relocs (bfd *abfd, relocations we need for this symbol. */ if (h != NULL) { - head = &((struct elf_s390_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; } else { @@ -1363,7 +1359,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = elf_s390_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -1395,11 +1391,9 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, { bfd_size_type pc_count = 0, count = 0; struct elf_dyn_relocs **pp; - struct elf_s390_link_hash_entry *eh; struct elf_dyn_relocs *p; - eh = (struct elf_s390_link_hash_entry *) h; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { pc_count += p->pc_count; p->count -= p->pc_count; @@ -1549,7 +1543,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, { struct bfd_link_info *info; struct elf_s390_link_hash_table *htab; - struct elf_s390_link_hash_entry *eh = (struct elf_s390_link_hash_entry *)h; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -1680,7 +1673,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -1695,7 +1688,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -1708,12 +1701,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -1753,13 +1746,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (Elf64_External_Rela); diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 4c9ad78dd74..183c8083464 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2315,7 +2315,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &eh->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 02df893fcdd..cbf10deaa4b 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -2570,9 +2570,6 @@ struct elf_aarch64_link_hash_entry { struct elf_link_hash_entry root; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - /* Since PLT entries have variable size, we need to record the index into .got.plt instead of recomputing it from the PLT offset. */ @@ -2728,7 +2725,6 @@ elfNN_aarch64_link_hash_newfunc (struct bfd_hash_entry *entry, table, string)); if (ret != NULL) { - ret->dyn_relocs = NULL; ret->got_type = GOT_UNKNOWN; ret->plt_got_offset = (bfd_vma) - 1; ret->stub_cache = NULL; @@ -2855,20 +2851,20 @@ elfNN_aarch64_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf_aarch64_link_hash_entry *) dir; eind = (struct elf_aarch64_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL;) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL;) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -2879,11 +2875,11 @@ elfNN_aarch64_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect) @@ -7392,7 +7388,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = elf_aarch64_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -7410,7 +7406,7 @@ need_copy_relocation_p (struct elf_aarch64_link_hash_entry *eh) struct elf_dyn_relocs *p; asection *s; - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = eh->root.dyn_relocs; p != NULL; p = p->next) { /* If there is any pc-relative reference, we need to keep copy relocation to avoid propagating the relocation into runtime that current glibc @@ -7889,9 +7885,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, relocations we need for this symbol. */ if (h != NULL) { - struct elf_aarch64_link_hash_entry *eh; - eh = (struct elf_aarch64_link_hash_entry *) h; - head = &eh->dyn_relocs; + head = &h->dyn_relocs; } else { @@ -8752,7 +8746,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) h->got.offset = (bfd_vma) - 1; } - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -8773,7 +8767,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL;) + for (pp = &h->dyn_relocs; (p = *pp) != NULL;) { p->count -= p->pc_count; p->pc_count = 0; @@ -8786,11 +8780,11 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -8829,13 +8823,13 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep:; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc; @@ -8858,7 +8852,6 @@ elfNN_aarch64_allocate_ifunc_dynrelocs (struct elf_link_hash_entry *h, { struct bfd_link_info *info; struct elf_aarch64_link_hash_table *htab; - struct elf_aarch64_link_hash_entry *eh; /* An example of a bfd_link_hash_indirect symbol is versioned symbol. For example: __gxx_personality_v0(bfd_link_hash_indirect) @@ -8878,14 +8871,12 @@ elfNN_aarch64_allocate_ifunc_dynrelocs (struct elf_link_hash_entry *h, info = (struct bfd_link_info *) inf; htab = elf_aarch64_hash_table (info); - eh = (struct elf_aarch64_link_hash_entry *) h; - /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it here if it is defined and referenced in a non-shared object. */ if (h->type == STT_GNU_IFUNC && h->def_regular) return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, - &eh->dyn_relocs, + &h->dyn_relocs, NULL, htab->plt_entry_size, htab->plt_header_size, diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 5fa6e35d061..f6c92b80282 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -61,9 +61,6 @@ struct riscv_elf_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - #define GOT_UNKNOWN 0 #define GOT_NORMAL 1 #define GOT_TLS_GD 2 @@ -264,7 +261,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct riscv_elf_link_hash_entry *eh; eh = (struct riscv_elf_link_hash_entry *) entry; - eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; } @@ -419,20 +415,20 @@ riscv_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct riscv_elf_link_hash_entry *) dir; eind = (struct riscv_elf_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -443,11 +439,11 @@ riscv_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect @@ -705,7 +701,7 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct riscv_elf_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. @@ -793,7 +789,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = riscv_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -944,7 +940,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct bfd_link_info *info; struct riscv_elf_link_hash_table *htab; - struct riscv_elf_link_hash_entry *eh; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -1053,8 +1048,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else h->got.offset = (bfd_vma) -1; - eh = (struct riscv_elf_link_hash_entry *) h; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -1069,7 +1063,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -1082,12 +1076,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -1127,13 +1121,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * sizeof (ElfNN_External_Rela); diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index d2bb36648c6..d6e3b6d437e 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -690,9 +690,6 @@ struct _bfd_sparc_elf_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - #define GOT_UNKNOWN 0 #define GOT_NORMAL 1 #define GOT_TLS_GD 2 @@ -1028,7 +1025,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct _bfd_sparc_elf_link_hash_entry *eh; eh = (struct _bfd_sparc_elf_link_hash_entry *) entry; - eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; eh->has_got_reloc = 0; eh->has_non_got_reloc = 0; @@ -1289,20 +1285,20 @@ _bfd_sparc_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct _bfd_sparc_elf_link_hash_entry *) dir; eind = (struct _bfd_sparc_elf_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -1313,11 +1309,11 @@ _bfd_sparc_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect && dir->got.refcount <= 0) @@ -1790,7 +1786,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = &((struct _bfd_sparc_elf_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. @@ -1930,7 +1926,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = _bfd_sparc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2257,7 +2253,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -2272,7 +2268,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -2287,7 +2283,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { if (strcmp (p->sec->output_section->name, ".tls_vars") == 0) *pp = p->next; @@ -2298,7 +2294,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Also discard relocs on undefined weak syms with non-default visibility or in PIE. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { /* An undefined weak symbol is never @@ -2313,7 +2309,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) can branch to 0 without PLT. */ struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL;) + for (pp = &h->dyn_relocs; (p = *pp) != NULL;) if (p->pc_count == 0) *pp = p->next; else @@ -2323,7 +2319,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) pp = &p->next; } - if (eh->dyn_relocs != NULL) + if (h->dyn_relocs != NULL) { /* Make sure undefined weak symbols are output as dynamic symbols in PIEs for dynamic non-GOT @@ -2333,7 +2329,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) } } else - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; } /* Make sure undefined weak symbols are output as a dynamic @@ -2377,13 +2373,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * SPARC_ELF_RELA_BYTES (htab); diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index 3f063d0929e..3e73e0b18eb 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -785,9 +785,6 @@ struct tilegx_elf_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - #define GOT_UNKNOWN 0 #define GOT_NORMAL 1 #define GOT_TLS_GD 2 @@ -1356,7 +1353,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct tilegx_elf_link_hash_entry *eh; eh = (struct tilegx_elf_link_hash_entry *) entry; - eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; } @@ -1505,20 +1501,20 @@ tilegx_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct tilegx_elf_link_hash_entry *) dir; eind = (struct tilegx_elf_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -1529,11 +1525,11 @@ tilegx_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect @@ -2003,8 +1999,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* If this is a global symbol, we count the number of relocations we need for this symbol. */ if (h != NULL) - head = - &((struct tilegx_elf_link_hash_entry *) h)->dyn_relocs; + head = &h->dyn_relocs; else { /* Track dynamic relocs needed for local syms too. @@ -2126,7 +2121,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = tilegx_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -2271,7 +2266,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct bfd_link_info *info; struct tilegx_elf_link_hash_table *htab; - struct tilegx_elf_link_hash_entry *eh; struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) @@ -2380,8 +2374,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else h->got.offset = (bfd_vma) -1; - eh = (struct tilegx_elf_link_hash_entry *) h; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -2396,7 +2389,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -2409,12 +2402,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; /* Make sure undefined weak symbols are output as a dynamic symbol in PIEs. */ @@ -2454,13 +2447,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; sreloc->size += p->count * TILEGX_ELF_RELA_BYTES (htab); diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 6cc47afd7ea..e385ddb5391 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -131,7 +131,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) if (h->type == STT_GNU_IFUNC && h->def_regular) { - if (_bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs, + if (_bfd_elf_allocate_ifunc_dyn_relocs (info, h, &h->dyn_relocs, &htab->readonly_dynrelocs_against_ifunc, plt_entry_size, (htab->plt.has_plt0 @@ -375,7 +375,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) else h->got.offset = (bfd_vma) -1; - if (eh->dyn_relocs == NULL) + if (h->dyn_relocs == NULL) return TRUE; /* In the shared -Bsymbolic case, discard space allocated for @@ -396,7 +396,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { p->count -= p->pc_count; p->pc_count = 0; @@ -410,7 +410,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) if (htab->target_os == is_vxworks) { struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { if (strcmp (p->sec->output_section->name, ".tls_vars") == 0) *pp = p->next; @@ -421,7 +421,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility or in PIE. */ - if (eh->dyn_relocs != NULL) + if (h->dyn_relocs != NULL) { if (h->root.type == bfd_link_hash_undefweak) { @@ -437,7 +437,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) that we can branch to 0 without PLT. */ struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) if (p->pc_count == 0) *pp = p->next; else @@ -450,12 +450,12 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Make sure undefined weak symbols are output as dynamic symbols in PIEs for dynamic non-GOT non-PLT reloations. */ - if (eh->dyn_relocs != NULL + if (h->dyn_relocs != NULL && !bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; } else - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; } else if (h->dynindx == -1 && !h->forced_local @@ -472,7 +472,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) which turn out to need copy relocs. */ struct elf_dyn_relocs **pp; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { if (p->pc_count != 0) *pp = p->next; @@ -513,13 +513,13 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) goto keep; } - eh->dyn_relocs = NULL; + h->dyn_relocs = NULL; keep: ; } /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *sreloc; @@ -539,7 +539,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) { struct elf_dyn_relocs *p; - for (p = elf_x86_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + for (p = h->dyn_relocs; p != NULL; p = p->next) { asection *s = p->sec->output_section; @@ -1783,20 +1783,20 @@ _bfd_x86_elf_copy_indirect_symbol (struct bfd_link_info *info, edir = (struct elf_x86_link_hash_entry *) dir; eind = (struct elf_x86_link_hash_entry *) ind; - if (eind->dyn_relocs != NULL) + if (ind->dyn_relocs != NULL) { - if (edir->dyn_relocs != NULL) + if (dir->dyn_relocs != NULL) { struct elf_dyn_relocs **pp; struct elf_dyn_relocs *p; /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &ind->dyn_relocs; (p = *pp) != NULL; ) { struct elf_dyn_relocs *q; - for (q = edir->dyn_relocs; q != NULL; q = q->next) + for (q = dir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) { q->pc_count += p->pc_count; @@ -1807,11 +1807,11 @@ _bfd_x86_elf_copy_indirect_symbol (struct bfd_link_info *info, if (q == NULL) pp = &p->next; } - *pp = edir->dyn_relocs; + *pp = dir->dyn_relocs; } - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; + dir->dyn_relocs = ind->dyn_relocs; + ind->dyn_relocs = NULL; } if (ind->root.type == bfd_link_hash_indirect @@ -1950,7 +1950,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info, struct elf_dyn_relocs **pp; eh = (struct elf_x86_link_hash_entry *) h; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + for (pp = &h->dyn_relocs; (p = *pp) != NULL; ) { pc_count += p->pc_count; p->count -= p->pc_count; diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h index 6e91f242622..b64c41390ac 100644 --- a/bfd/elfxx-x86.h +++ b/bfd/elfxx-x86.h @@ -250,9 +250,6 @@ struct elf_x86_link_hash_entry { struct elf_link_hash_entry elf; - /* Track dynamic relocs copied for this symbol. */ - struct elf_dyn_relocs *dyn_relocs; - unsigned char tls_type; /* Bit 0: Symbol has no GOT nor PLT relocations.