Delete powerpc64 symbol weakref field
authorAlan Modra <amodra@gmail.com>
Wed, 22 Nov 2017 07:02:50 +0000 (17:32 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 23 Nov 2017 12:11:43 +0000 (22:41 +1030)
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
bfd/elf64-ppc.c

index f21c606553f5b4dc27771b4bf53b983ff72f5170..40776497908ea7e52375d294f48233f7b4f41a0b 100644 (file)
@@ -1,3 +1,11 @@
+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.
index 1a4b7216149e8e67fd62f409e34e3b7f1ce2e28d..0eeea421e0ab662734bb0b9c15fdf916783d244f 100644 (file)
@@ -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.  */
This page took 0.032036 seconds and 4 git commands to generate.