* elf64-ppc.c (move_plt_plist): New function, extracted from..
authorAlan Modra <amodra@gmail.com>
Fri, 11 Feb 2005 03:47:40 +0000 (03:47 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 11 Feb 2005 03:47:40 +0000 (03:47 +0000)
(ppc64_elf_copy_indirect_symbol): ..here.
(func_desc_adjust): Use move_plt_plist.

bfd/ChangeLog
bfd/elf64-ppc.c

index 37e3b81c1b88d008863c860a52decd7fa726cdf4..f73afa1170d65f14b1eb236c7e69570059a6fd68 100644 (file)
@@ -1,3 +1,9 @@
+2005-02-11  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (move_plt_plist): New function, extracted from..
+       (ppc64_elf_copy_indirect_symbol): ..here.
+       (func_desc_adjust): Use move_plt_plist.
+
 2005-02-10  Paul Brook  <paul@codesourcery.com>
 
        * elf32-arm.c (elf32_arm_final_link_relocate): Handle R_ARM_THM_PC9.
index 0c3d35b5df73053cdf8650feeb8ad5602e207fe9..4162d55fc8574b69c258850663d13849e1038c5b 100644 (file)
@@ -3766,6 +3766,41 @@ ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
   return TRUE;
 }
 
+/* Merge PLT info on FROM with that on TO.  */
+
+static void
+move_plt_plist (struct ppc_link_hash_entry *from,
+               struct ppc_link_hash_entry *to)
+{
+  if (from->elf.plt.plist != NULL)
+    {
+      if (to->elf.plt.plist != NULL)
+       {
+         struct plt_entry **entp;
+         struct plt_entry *ent;
+
+         for (entp = &from->elf.plt.plist; (ent = *entp) != NULL; )
+           {
+             struct plt_entry *dent;
+
+             for (dent = to->elf.plt.plist; dent != NULL; dent = dent->next)
+               if (dent->addend == ent->addend)
+                 {
+                   dent->plt.refcount += ent->plt.refcount;
+                   *entp = ent->next;
+                   break;
+                 }
+             if (dent == NULL)
+               entp = &ent->next;
+           }
+         *entp = to->elf.plt.plist;
+       }
+
+      to->elf.plt.plist = from->elf.plt.plist;
+      from->elf.plt.plist = NULL;
+    }
+}
+
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
@@ -3868,33 +3903,7 @@ ppc64_elf_copy_indirect_symbol
     }
 
   /* And plt entries.  */
-  if (eind->elf.plt.plist != NULL)
-    {
-      if (edir->elf.plt.plist != NULL)
-       {
-         struct plt_entry **entp;
-         struct plt_entry *ent;
-
-         for (entp = &eind->elf.plt.plist; (ent = *entp) != NULL; )
-           {
-             struct plt_entry *dent;
-
-             for (dent = edir->elf.plt.plist; dent != NULL; dent = dent->next)
-               if (dent->addend == ent->addend)
-                 {
-                   dent->plt.refcount += ent->plt.refcount;
-                   *entp = ent->next;
-                   break;
-                 }
-             if (dent == NULL)
-               entp = &ent->next;
-           }
-         *entp = edir->elf.plt.plist;
-       }
-
-      edir->elf.plt.plist = eind->elf.plt.plist;
-      eind->elf.plt.plist = NULL;
-    }
+  move_plt_plist (eind, edir);
 
   if (edir->elf.dynindx == -1)
     {
@@ -5462,11 +5471,7 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
       fdh->elf.non_got_ref |= fh->elf.non_got_ref;
       if (ELF_ST_VISIBILITY (fh->elf.other) == STV_DEFAULT)
        {
-         struct plt_entry **ep = &fdh->elf.plt.plist;
-         while (*ep != NULL)
-           ep = &(*ep)->next;
-         *ep = fh->elf.plt.plist;
-         fh->elf.plt.plist = NULL;
+         move_plt_plist (fh, fdh);
          fdh->elf.needs_plt = 1;
        }
       fdh->is_func_descriptor = 1;
This page took 0.041685 seconds and 4 git commands to generate.