]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ELF: Copy dyn_relocs in _bfd_elf_link_hash_copy_indirect
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Jun 2020 14:03:45 +0000 (07:03 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Jun 2020 14:03:59 +0000 (07:03 -0700)
Copy dyn_relocs in _bfd_elf_link_hash_copy_indirect instead of in each
target backend.

PR ld/26067
* elf32-arm.c (elf32_arm_copy_indirect_symbol): Don't copy
dyn_relocs.
* elf32-csky.c (csky_elf_copy_indirect_symbol): Likewise.
* elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
* elf32-metag.c (elf_metag_copy_indirect_symbol): Likewise.
* elf32-microblaze.c (microblaze_elf_copy_indirect_symbol):
Likewise.
* elf32-nds32.c (nds32_elf_copy_indirect_symbol): Likewise.
* elf32-nios2.c (nios2_elf32_copy_indirect_symbol): Likewise.
* elf32-or1k.c (or1k_elf_copy_indirect_symbol): Likewise.
* elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
* elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
* elf32-tilepro.c (tilepro_elf_copy_indirect_symbol): Likewise.
* elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_copy_indirect_symbol): Likewise.
* elfnn-riscv.c (riscv_elf_copy_indirect_symbol): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
* elfxx-tilegx.c (tilegx_elf_copy_indirect_symbol): Likewise.
* elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Likewise.
* elf32-lm32.c (lm32_elf_copy_indirect_symbol): Removed.
(elf_backend_copy_indirect_symbol): Likewise.
* elf32-m32r.c (m32r_elf_copy_indirect_symbol): Removed.
(elf_backend_copy_indirect_symbol): Likewise.
* elflink.c (_bfd_elf_link_hash_copy_indirect): Copy dyn_relocs.

21 files changed:
bfd/ChangeLog
bfd/elf32-arm.c
bfd/elf32-csky.c
bfd/elf32-hppa.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-metag.c
bfd/elf32-microblaze.c
bfd/elf32-nds32.c
bfd/elf32-nios2.c
bfd/elf32-or1k.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-tilepro.c
bfd/elf64-s390.c
bfd/elflink.c
bfd/elfnn-aarch64.c
bfd/elfnn-riscv.c
bfd/elfxx-sparc.c
bfd/elfxx-tilegx.c
bfd/elfxx-x86.c

index 64f01ef5ef6a5adba03f7f168c5aae0efd236956..0bafecef2fa6c50c8e65eb35806d1bffd79732b0 100644 (file)
@@ -1,3 +1,31 @@
+2020-06-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/26067
+       * elf32-arm.c (elf32_arm_copy_indirect_symbol): Don't copy
+       dyn_relocs.
+       * elf32-csky.c (csky_elf_copy_indirect_symbol): Likewise.
+       * elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Likewise.
+       * elf32-metag.c (elf_metag_copy_indirect_symbol): Likewise.
+       * elf32-microblaze.c (microblaze_elf_copy_indirect_symbol):
+       Likewise.
+       * elf32-nds32.c (nds32_elf_copy_indirect_symbol): Likewise.
+       * elf32-nios2.c (nios2_elf32_copy_indirect_symbol): Likewise.
+       * elf32-or1k.c (or1k_elf_copy_indirect_symbol): Likewise.
+       * elf32-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+       * elf32-sh.c (sh_elf_copy_indirect_symbol): Likewise.
+       * elf32-tilepro.c (tilepro_elf_copy_indirect_symbol): Likewise.
+       * elf64-s390.c (elf_s390_copy_indirect_symbol): Likewise.
+       * elfnn-aarch64.c (elfNN_aarch64_copy_indirect_symbol): Likewise.
+       * elfnn-riscv.c (riscv_elf_copy_indirect_symbol): Likewise.
+       * elfxx-sparc.c (_bfd_sparc_elf_copy_indirect_symbol): Likewise.
+       * elfxx-tilegx.c (tilegx_elf_copy_indirect_symbol): Likewise.
+       * elfxx-x86.c (_bfd_x86_elf_copy_indirect_symbol): Likewise.
+       * elf32-lm32.c (lm32_elf_copy_indirect_symbol): Removed.
+       (elf_backend_copy_indirect_symbol): Likewise.
+       * elf32-m32r.c (m32r_elf_copy_indirect_symbol): Removed.
+       (elf_backend_copy_indirect_symbol): Likewise.
+       * elflink.c (_bfd_elf_link_hash_copy_indirect): Copy dyn_relocs.
+
 2020-06-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/26067
index 69d3ba16eebb1d7f413452267e128c10ab399cea..fc67ca5207772d5f9d803d92a372ec7b8cd9ad48 100644 (file)
@@ -4028,37 +4028,6 @@ elf32_arm_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf32_arm_link_hash_entry *) dir;
   eind = (struct elf32_arm_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect)
     {
       /* Copy over PLT info.  */
index 52708702a6507cf66f6cd485d49295a0adf6849f..03e83d53a50f568ba518a1800e28aa605e30277b 100644 (file)
@@ -2447,35 +2447,6 @@ csky_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct csky_elf_link_hash_entry *) dir;
   eind = (struct csky_elf_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {
index 15100431c8eb26459bf5da2aae7abf4bfa6637b7..106b5c83159c66ceb0613ba011ff9e89d0dbf8a4 100644 (file)
@@ -1040,42 +1040,6 @@ elf32_hppa_copy_indirect_symbol (struct bfd_link_info *info,
   hh_dir = hppa_elf_hash_entry (eh_dir);
   hh_ind = hppa_elf_hash_entry (eh_ind);
 
-  if (eh_ind->dyn_relocs != NULL
-      && eh_ind->root.type == bfd_link_hash_indirect)
-    {
-      if (eh_dir->dyn_relocs != NULL)
-       {
-         struct elf_dyn_relocs **hdh_pp;
-         struct elf_dyn_relocs *hdh_p;
-
-         /* Add reloc counts against the indirect sym to the direct sym
-            list.  Merge any entries against the same section.  */
-         for (hdh_pp = &eh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; )
-           {
-             struct elf_dyn_relocs *hdh_q;
-
-             for (hdh_q = eh_dir->dyn_relocs;
-                  hdh_q != NULL;
-                  hdh_q = hdh_q->next)
-               if (hdh_q->sec == hdh_p->sec)
-                 {
-#if RELATIVE_DYNRELOCS
-                   hdh_q->pc_count += hdh_p->pc_count;
-#endif
-                   hdh_q->count += hdh_p->count;
-                   *hdh_pp = hdh_p->next;
-                   break;
-                 }
-             if (hdh_q == NULL)
-               hdh_pp = &hdh_p->next;
-           }
-         *hdh_pp = eh_dir->dyn_relocs;
-       }
-
-      eh_dir->dyn_relocs = eh_ind->dyn_relocs;
-      eh_ind->dyn_relocs = NULL;
-    }
-
   if (eh_ind->root.type == bfd_link_hash_indirect)
     {
       hh_dir->plabel |= hh_ind->plabel;
index 9e958617f80fd89f0195f948b953094acc0b6700..5d09f2d350d0a475472baa6d898c727522ab68cb 100644 (file)
@@ -2390,47 +2390,6 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
   return TRUE;
 }
 
-/* Copy the extra info we tack onto an elf_link_hash_entry.  */
-
-static void
-lm32_elf_copy_indirect_symbol (struct bfd_link_info *info,
-                              struct elf_link_hash_entry *dir,
-                              struct elf_link_hash_entry *ind)
-{
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL;)
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
-  _bfd_elf_link_hash_copy_indirect (info, dir, ind);
-}
-
 static bfd_boolean
 lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
 {
@@ -2518,7 +2477,6 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
 #define bfd_elf32_bfd_link_hash_table_create   lm32_elf_link_hash_table_create
 #define elf_backend_check_relocs               lm32_elf_check_relocs
 #define elf_backend_reloc_type_class           lm32_elf_reloc_type_class
-#define elf_backend_copy_indirect_symbol       lm32_elf_copy_indirect_symbol
 #define elf_backend_size_dynamic_sections      lm32_elf_size_dynamic_sections
 #define elf_backend_omit_section_dynsym                _bfd_elf_omit_section_dynsym_all
 #define elf_backend_create_dynamic_sections    lm32_elf_create_dynamic_sections
index f719a532d466cf810e3c5203c0382950195bc1f7..afe0ee899cd724262078afc4445069ec9ffa0878 100644 (file)
@@ -1658,47 +1658,6 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
   return TRUE;
 }
 
-/* Copy the extra info we tack onto an elf_link_hash_entry.  */
-
-static void
-m32r_elf_copy_indirect_symbol (struct bfd_link_info *info,
-                              struct elf_link_hash_entry *dir,
-                              struct elf_link_hash_entry *ind)
-{
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL;)
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
-  _bfd_elf_link_hash_copy_indirect (info, dir, ind);
-}
-
 \f
 /* Adjust a symbol defined by a dynamic object and referenced by a
    regular object.  The current definition is in some section of the
@@ -3811,7 +3770,6 @@ m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
 #define elf_backend_adjust_dynamic_symbol      m32r_elf_adjust_dynamic_symbol
 #define elf_backend_finish_dynamic_symbol      m32r_elf_finish_dynamic_symbol
 #define elf_backend_reloc_type_class           m32r_elf_reloc_type_class
-#define elf_backend_copy_indirect_symbol       m32r_elf_copy_indirect_symbol
 
 #define elf_backend_can_gc_sections            1
 /*#if !USE_REL
index b2cb918d4c856ef2350e14c4df31bf4878f81e14..d5e9a9d034e5eacdc8bda7d32dd9a0bb6e376135 100644 (file)
@@ -2390,41 +2390,6 @@ elf_metag_copy_indirect_symbol (struct bfd_link_info *info,
   hh_dir = metag_elf_hash_entry (eh_dir);
   hh_ind = metag_elf_hash_entry (eh_ind);
 
-  if (eh_ind->dyn_relocs != NULL)
-    {
-      if (eh_dir->dyn_relocs != NULL)
-       {
-         struct elf_dyn_relocs **hdh_pp;
-         struct elf_dyn_relocs *hdh_p;
-
-         if (eh_ind->root.type == bfd_link_hash_indirect)
-           abort ();
-
-         /* Add reloc counts against the weak sym to the strong sym
-            list.  Merge any entries against the same section.  */
-         for (hdh_pp = &eh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; )
-           {
-             struct elf_dyn_relocs *hdh_q;
-
-             for (hdh_q = eh_dir->dyn_relocs; hdh_q != NULL;
-                  hdh_q = hdh_q->next)
-               if (hdh_q->sec == hdh_p->sec)
-                 {
-                   hdh_q->pc_count += hdh_p->pc_count;
-                   hdh_q->count += hdh_p->count;
-                   *hdh_pp = hdh_p->next;
-                   break;
-                 }
-             if (hdh_q == NULL)
-               hdh_pp = &hdh_p->next;
-           }
-         *hdh_pp = eh_dir->dyn_relocs;
-       }
-
-      eh_dir->dyn_relocs = eh_ind->dyn_relocs;
-      eh_ind->dyn_relocs = NULL;
-    }
-
   if (eh_ind->root.type == bfd_link_hash_indirect
       && eh_dir->got.refcount <= 0)
     {
index 92c5e7c30314552a26f6e054738f26082c911873..caf0f2edcaa2a95c20c038a9b49cec51af22007d 100644 (file)
@@ -2575,40 +2575,6 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf32_mb_link_hash_entry *) dir;
   eind = (struct elf32_mb_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->dyn_relocs != NULL)
-       {
-         struct elf_dyn_relocs **pp;
-         struct elf_dyn_relocs *p;
-
-         if (ind->root.type == bfd_link_hash_indirect)
-           abort ();
-
-         /* Add reloc counts against the weak sym to the strong sym
-            list.  Merge any entries against the same section.  */
-         for (pp = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   edir->tls_mask |= eind->tls_mask;
 
   _bfd_elf_link_hash_copy_indirect (info, dir, ind);
index ad5225fcd7cd2395163c1cba0858c698c10acae0..4f7ea764691f81408cc50c78e471cf7d4c8e56dd 100644 (file)
@@ -3874,40 +3874,6 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf_nds32_link_hash_entry *) dir;
   eind = (struct elf_nds32_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->dyn_relocs != NULL)
-       {
-         struct elf_dyn_relocs **pp;
-         struct elf_dyn_relocs *p;
-
-         if (ind->root.type == bfd_link_hash_indirect)
-           abort ();
-
-         /* Add reloc counts against the weak sym to the strong sym
-            list.  Merge any entries against the same section.  */
-         for (pp = &ind->dyn_relocs; (p = *pp) != NULL;)
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect)
     {
       if (dir->got.refcount <= 0)
index 6b4b092e2df5fa20e62e74a806946c8ffc88b0df..aabec1d6d67cf3d216cdf6cf5d6288f7efc7555c 100644 (file)
@@ -4637,37 +4637,6 @@ nios2_elf32_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf32_nios2_link_hash_entry *) dir;
   eind = (struct elf32_nios2_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {
index 01556266c109bf2f32f1d5630c49b962edb57c5b..b141b45886d19d37abb301d580d3781512effdd3 100644 (file)
@@ -3177,37 +3177,6 @@ or1k_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf_or1k_link_hash_entry *) dir;
   eind = (struct elf_or1k_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL;)
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect)
     {
       if (dir->got.refcount <= 0)
index c0db4f9bc8efb7966dee0fa256af829fb0c79663..42f230d9b14c0d8029fc2d54426765d4792687a4 100644 (file)
@@ -828,37 +828,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 (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {
index 29cdb3b5696d8d2a810363cb90a154d55b728709..0428829757f9de859190e4b60b5f52a9a73ea366 100644 (file)
@@ -5303,36 +5303,6 @@ sh_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf_sh_link_hash_entry *) dir;
   eind = (struct elf_sh_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
   edir->gotplt_refcount = eind->gotplt_refcount;
   eind->gotplt_refcount = 0;
   edir->funcdesc.refcount += eind->funcdesc.refcount;
index cb6cda811776f3b201d4985aa3296cade73f8bfe..9707a9e18e5b4cda77142b2e72c3bbf2e104a8b0 100644 (file)
@@ -1292,37 +1292,6 @@ tilepro_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct tilepro_elf_link_hash_entry *) dir;
   eind = (struct tilepro_elf_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {
index 07ec4709bbfb8becef63bf102bd705ea951b0719..197e9bc68c7ac4e8b436a9c6304f70585020748a 100644 (file)
@@ -747,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 (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {
index 0d659c20257a663e38511d8126157509cbcd4413..a2b40ccb046bbd32ae811395f3294026a5388f08 100644 (file)
@@ -7650,6 +7650,37 @@ _bfd_elf_link_hash_copy_indirect (struct bfd_link_info *info,
 {
   struct elf_link_hash_table *htab;
 
+  if (ind->dyn_relocs != NULL)
+    {
+      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
+           {
+             struct elf_dyn_relocs *q;
+
+             for (q = dir->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 = dir->dyn_relocs;
+       }
+
+      dir->dyn_relocs = ind->dyn_relocs;
+      ind->dyn_relocs = NULL;
+    }
+
   /* Copy down any references that we may have already seen to the
      symbol which just became indirect.  */
 
index f521786c8c3183fde85260fba1ccafba28e68a27..71634ffba773b63d58dc0242b3ed1d21a3ee5e64 100644 (file)
@@ -2851,37 +2851,6 @@ elfNN_aarch64_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf_aarch64_link_hash_entry *) dir;
   eind = (struct elf_aarch64_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL;)
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect)
     {
       /* Copy over PLT info.  */
index 1b530d83dffd76e42aee66ac6d4ef5bd584dcbce..3c972e20ab59aa962b7641e81f6874cca1498f97 100644 (file)
@@ -415,37 +415,6 @@ riscv_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct riscv_elf_link_hash_entry *) dir;
   eind = (struct riscv_elf_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {
index 633ac59bcc1d13ceb5c3e8c5822432a2be6a6b82..e4700e31069daf489f6d0ddadfafd90a5337c183 100644 (file)
@@ -1285,37 +1285,6 @@ _bfd_sparc_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct _bfd_sparc_elf_link_hash_entry *) dir;
   eind = (struct _bfd_sparc_elf_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect && dir->got.refcount <= 0)
     {
       edir->tls_type = eind->tls_type;
index 75b4621276705e049f97c3c5b7484bd8e6282bbc..07288a13e8c9510b0fd98ec7e74dbb6bd37a15ac 100644 (file)
@@ -1501,37 +1501,6 @@ tilegx_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct tilegx_elf_link_hash_entry *) dir;
   eind = (struct tilegx_elf_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {
index c89559914e77ae18196704097a45b60cbae6abca..b8c616f4d84ec09a0e381480a130ca9a3fce857a 100644 (file)
@@ -1766,37 +1766,6 @@ _bfd_x86_elf_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf_x86_link_hash_entry *) dir;
   eind = (struct elf_x86_link_hash_entry *) ind;
 
-  if (ind->dyn_relocs != NULL)
-    {
-      if (dir->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 = &ind->dyn_relocs; (p = *pp) != NULL; )
-           {
-             struct elf_dyn_relocs *q;
-
-             for (q = dir->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 = dir->dyn_relocs;
-       }
-
-      dir->dyn_relocs = ind->dyn_relocs;
-      ind->dyn_relocs = NULL;
-    }
-
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
     {