X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf64-s390.c;h=5b95b5f814ad239752452d9b60fbb1e7dcb15e4d;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=4ffcde92e212371e6ad8c4d21990276ae6a21c6d;hpb=fd3619828e94a24a92cddec42cbc0ab33352eeb4;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 4ffcde92e2..5b95b5f814 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1,5 +1,5 @@ /* IBM S/390-specific support for 64-bit ELF - Copyright (C) 2000-2019 Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. Contributed Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of BFD, the Binary File Descriptor library. @@ -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; @@ -722,7 +718,7 @@ static struct bfd_link_hash_table * elf_s390_link_hash_table_create (bfd *abfd) { struct elf_s390_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf_s390_link_hash_table); + size_t amt = sizeof (struct elf_s390_link_hash_table); ret = (struct elf_s390_link_hash_table *) bfd_zmalloc (amt); if (ret == NULL) @@ -751,37 +747,6 @@ 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 (edir->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; ) - { - struct elf_dyn_relocs *q; - - for (q = edir->dyn_relocs; q != NULL; q = q->next) - if (q->sec == p->sec) - { - q->pc_count += p->pc_count; - q->count += p->count; - *pp = p->next; - break; - } - if (q == NULL) - pp = &p->next; - } - *pp = edir->dyn_relocs; - } - - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; - } - if (ind->root.type == bfd_link_hash_indirect && dir->got.refcount <= 0) { @@ -1241,7 +1206,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 { @@ -1267,7 +1232,7 @@ elf_s390_check_relocs (bfd *abfd, p = *head; if (p == NULL || p->sec != sec) { - bfd_size_type amt = sizeof *p; + size_t amt = sizeof *p; p = ((struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj, amt)); if (p == NULL) @@ -1356,23 +1321,6 @@ elf_s390_adjust_gotplt (struct elf_s390_link_hash_entry *h) h->gotplt_refcount = -1; } -/* Find dynamic relocs for H that apply to read-only sections. */ - -static asection * -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) - { - asection *s = p->sec->output_section; - - if (s != NULL && (s->flags & SEC_READONLY) != 0) - return p->sec; - } - return NULL; -} - /* Adjust a symbol defined by a dynamic object and referenced by a regular object. The current definition is in some section of the dynamic object, but we're not including those sections. We have to @@ -1395,11 +1343,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; @@ -1498,7 +1444,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, /* If we don't find any dynamic relocs in read-only sections, then we'll be keeping the dynamic relocs and avoiding the copy reloc. */ - if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h)) + if (ELIMINATE_COPY_RELOCS && !_bfd_elf_readonly_dynrelocs (h)) { h->non_got_ref = 0; return TRUE; @@ -1549,7 +1495,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 +1625,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 +1640,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 +1653,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 +1698,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); @@ -1768,33 +1713,6 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, return TRUE; } -/* Set DF_TEXTREL if we find any dynamic relocs that apply to - read-only sections. */ - -static bfd_boolean -maybe_set_textrel (struct elf_link_hash_entry *h, void *info_p) -{ - asection *sec; - - if (h->root.type == bfd_link_hash_indirect) - return TRUE; - - sec = readonly_dynrelocs (h); - if (sec != NULL) - { - struct bfd_link_info *info = (struct bfd_link_info *) info_p; - - info->flags |= DF_TEXTREL; - info->callbacks->minfo - (_("%pB: dynamic relocation against `%pT' in read-only section `%pA'\n"), - sec->owner, h->root.root.string, sec); - - /* Not an error, just cut short the traversal. */ - return FALSE; - } - return TRUE; -} - /* Set the sizes of the dynamic sections. */ static bfd_boolean @@ -2036,7 +1954,8 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* If any dynamic relocs apply to a read-only section, then we need a DT_TEXTREL entry. */ if ((info->flags & DF_TEXTREL) == 0) - elf_link_hash_traverse (&htab->elf, maybe_set_textrel, info); + elf_link_hash_traverse (&htab->elf, + _bfd_elf_maybe_set_textrel, info); if ((info->flags & DF_TEXTREL) != 0) {