aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-11-22 17:32:50 +1030
committerAlan Modra <amodra@gmail.com>2017-11-23 22:41:43 +1030
commitab2477e15cbe067ff119f1bb5dea05de3cadbdd5 (patch)
treedbeba2d3022be787d76a7ad2070333b136ad8706
parent60d67dc84bbc7d73672d297d714f8a4a0547618d (diff)
downloadgdb-ab2477e15cbe067ff119f1bb5dea05de3cadbdd5.zip
gdb-ab2477e15cbe067ff119f1bb5dea05de3cadbdd5.tar.gz
gdb-ab2477e15cbe067ff119f1bb5dea05de3cadbdd5.tar.bz2
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.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf64-ppc.c46
2 files changed, 15 insertions, 39 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f21c606..4077649 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,13 @@
2017-11-23 Alan Modra <amodra@gmail.com>
+ * 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 <amodra@gmail.com>
+
* elf-bfd.h (struct elf_link_hash_entry): Add is_weakalias.
Rename u.weakdef to u.alias and update comment.
(weakdef): New static inline function.
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 1a4b721..0eeea42 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. */