Only discard space for pc-relative relocs symbols
[deliverable/binutils-gdb.git] / bfd / elf64-x86-64.c
index 581ee171773f243ccf952037e91cebf81f275ea1..6b7d3c9a56846bf4c622609b7ce77afbaeab94e3 100644 (file)
@@ -2742,13 +2742,23 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
                       && ! bfd_elf_link_record_dynamic_symbol (info, h))
                return FALSE;
            }
-         /* For PIE, discard space for relocs against symbols which
-            turn out to need copy relocs.  */
+         /* For PIE, discard space for pc-relative relocs against
+            symbols which turn out to need copy relocs.  */
          else if (info->executable
                   && (h->needs_copy || eh->needs_copy)
                   && h->def_dynamic
                   && !h->def_regular)
-           eh->dyn_relocs = NULL;
+           {
+             struct elf_dyn_relocs **pp;
+
+             for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+               {
+                 if (p->pc_count != 0)
+                   *pp = p->next;
+                 else
+                   pp = &p->next;
+               }
+           }
        }
     }
   else if (ELIMINATE_COPY_RELOCS)
This page took 0.028348 seconds and 4 git commands to generate.