From ab2477e15cbe067ff119f1bb5dea05de3cadbdd5 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 22 Nov 2017 17:32:50 +1030 Subject: [PATCH] Delete powerpc64 symbol weakref field Now that u.alias is circular, weakref just duplicates its function. Also, function symbols shouldn't be on the alias list so there is no need to use alias_readonly_dynrelocs with them. * elf64-ppc.c (struct ppc_link_hash_entry): Delete weakref field. (ppc64_elf_copy_indirect_symbol): Don't set weakref. (alias_readonly_dynrelocs): Use u.alias rather than weakref. (ppc64_elf_adjust_dynamic_symbol): Don't use alias_readonly_dynrelocs for function symbols. --- bfd/ChangeLog | 8 ++++++++ bfd/elf64-ppc.c | 46 +++++++--------------------------------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f21c606553f..40776497908 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2017-11-23 Alan Modra + + * elf64-ppc.c (struct ppc_link_hash_entry): Delete weakref field. + (ppc64_elf_copy_indirect_symbol): Don't set weakref. + (alias_readonly_dynrelocs): Use u.alias rather than weakref. + (ppc64_elf_adjust_dynamic_symbol): Don't use + alias_readonly_dynrelocs for function symbols. + 2017-11-23 Alan Modra * elf-bfd.h (struct elf_link_hash_entry): Add is_weakalias. diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 1a4b7216149..0eeea421e0a 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4001,9 +4001,6 @@ struct ppc_link_hash_entry /* Track dynamic relocs copied for this symbol. */ struct elf_dyn_relocs *dyn_relocs; - /* Chain of aliases referring to a weakdef. */ - struct ppc_link_hash_entry *weakref; - /* Link between function code and descriptor symbols. */ struct ppc_link_hash_entry *oh; @@ -4784,39 +4781,9 @@ ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info, in order to simplify readonly_dynrelocs and save a field in the symbol hash entry, but that means dyn_relocs can't be used in any tests about a specific symbol, or affect other symbol flags which - are then tested. - Chain weakdefs so we can get from the weakdef back to an alias. - The list is circular so that we don't need to use u.weakdef as - well as this list to look at all aliases. */ + are then tested. */ if (eind->elf.root.type != bfd_link_hash_indirect) - { - struct ppc_link_hash_entry *cur, *add, *next; - - add = eind; - do - { - cur = edir->weakref; - if (cur != NULL) - { - do - { - /* We can be called twice for the same symbols. - Don't make multiple loops. */ - if (cur == add) - return; - cur = cur->weakref; - } while (cur != edir); - } - next = add->weakref; - if (cur != add) - { - add->weakref = edir->weakref != NULL ? edir->weakref : edir; - edir->weakref = add; - } - add = next; - } while (add != NULL && add != eind); - return; - } + return; /* Copy over any dynamic relocs we may have on the indirect sym. */ if (eind->dyn_relocs != NULL) @@ -7104,7 +7071,8 @@ readonly_dynrelocs (struct elf_link_hash_entry *h) } /* Return true if we have dynamic relocs against H or any of its weak - aliases, that apply to read-only sections. */ + aliases, that apply to read-only sections. Cannot be used after + size_dynamic_sections. */ static bfd_boolean alias_readonly_dynrelocs (struct elf_link_hash_entry *h) @@ -7116,7 +7084,7 @@ alias_readonly_dynrelocs (struct elf_link_hash_entry *h) { if (readonly_dynrelocs (&eh->elf)) return TRUE; - eh = eh->weakref; + eh = (struct ppc_link_hash_entry *) eh->elf.u.alias; } while (eh != NULL && &eh->elf != h); return FALSE; @@ -7218,7 +7186,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, extra work in ld.so when resolving these symbols. */ if (global_entry_stub (h)) { - if (!alias_readonly_dynrelocs (h)) + if (!readonly_dynrelocs (h)) { h->pointer_equality_needed = 0; /* If we haven't seen a branch reloc then we don't need @@ -7236,7 +7204,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } else if (!h->needs_plt - && !alias_readonly_dynrelocs (h)) + && !readonly_dynrelocs (h)) { /* If we haven't seen a branch reloc then we don't need a plt entry. */ -- 2.30.2