ELF: Move dyn_relocs to struct elf_link_hash_entry
[deliverable/binutils-gdb.git] / bfd / elf32-csky.c
index 06ea26632d147fc01aaf7387cb8f98417bc7d575..4be7ea8aa60304a230cf51a93f44e132ed6f9db3 100644 (file)
@@ -1163,8 +1163,6 @@ struct csky_elf_link_hash_entry
   int plt_refcount;
   /* For sub jsri2bsr relocs count.  */
   int jsri2bsr_refcount;
-  /* Track dynamic relocs copied for this symbol.  */
-  struct elf_dyn_relocs *dyn_relocs;
 
 #define GOT_UNKNOWN     0
 #define GOT_NORMAL      1
@@ -1429,7 +1427,6 @@ csky_elf_link_hash_newfunc (struct bfd_hash_entry * entry,
       struct csky_elf_link_hash_entry *eh;
 
       eh = (struct csky_elf_link_hash_entry *) ret;
-      eh->dyn_relocs = NULL;
       eh->plt_refcount = 0;
       eh->jsri2bsr_refcount = 0;
       eh->tls_type = GOT_NORMAL;
@@ -1804,7 +1801,7 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
     h->got.offset = (bfd_vma) -1;
 
   eh = (struct csky_elf_link_hash_entry *) h;
-  if (eh->dyn_relocs == NULL)
+  if (h->dyn_relocs == NULL)
     return TRUE;
 
   /* In the shared -Bsymbolic case, discard space allocated for
@@ -1819,7 +1816,7 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
        {
          struct elf_dyn_relocs **pp;
 
-         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+         for (pp = &h->dyn_relocs; (p = *pp) != NULL; )
            {
              p->count -= p->pc_count;
              p->pc_count = 0;
@@ -1832,17 +1829,17 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
 
       if (eh->jsri2bsr_refcount
          && h->root.type == bfd_link_hash_defined
-         && eh->dyn_relocs != NULL)
-       eh->dyn_relocs->count -= eh->jsri2bsr_refcount;
+         && h->dyn_relocs != NULL)
+       h->dyn_relocs->count -= eh->jsri2bsr_refcount;
 
       /* Also discard relocs on undefined weak syms with non-default
         visibility.  */
-      if (eh->dyn_relocs != NULL
+      if (h->dyn_relocs != NULL
          && h->root.type == bfd_link_hash_undefweak)
        {
          if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
              || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
-           eh->dyn_relocs = NULL;
+           h->dyn_relocs = NULL;
 
          /* Make sure undefined weak symbols are output as a dynamic
             symbol in PIEs.  */
@@ -1881,13 +1878,13 @@ csky_allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
            goto keep;
        }
 
-      eh->dyn_relocs = NULL;
+      h->dyn_relocs = NULL;
 
       keep: ;
     }
 
   /* Finally, allocate space.  */
-  for (p = eh->dyn_relocs; p != NULL; p = p->next)
+  for (p = h->dyn_relocs; p != NULL; p = p->next)
     {
       asection *srelgot = htab->elf.srelgot;
       srelgot->size += p->count * sizeof (Elf32_External_Rela);
@@ -1901,7 +1898,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h)
 {
   struct elf_dyn_relocs *p;
 
-  for (p = csky_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
+  for (p = h->dyn_relocs; p != NULL; p = p->next)
     {
       asection *s = p->sec->output_section;
 
@@ -2465,20 +2462,20 @@ 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 (eind->dyn_relocs != NULL)
+  if (ind->dyn_relocs != NULL)
     {
-      if (edir->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 = &eind->dyn_relocs; (p = *pp) != NULL; )
+         for (pp = &ind->dyn_relocs; (p = *pp) != NULL; )
            {
              struct elf_dyn_relocs *q;
 
-             for (q = edir->dyn_relocs; q != NULL; q = q->next)
+             for (q = dir->dyn_relocs; q != NULL; q = q->next)
                if (q->sec == p->sec)
                  {
                    q->pc_count += p->pc_count;
@@ -2489,10 +2486,10 @@ csky_elf_copy_indirect_symbol (struct bfd_link_info *info,
              if (q == NULL)
                pp = &p->next;
            }
-         *pp = edir->dyn_relocs;
+         *pp = dir->dyn_relocs;
        }
-      edir->dyn_relocs = eind->dyn_relocs;
-      eind->dyn_relocs = NULL;
+      dir->dyn_relocs = ind->dyn_relocs;
+      ind->dyn_relocs = NULL;
     }
   if (ind->root.type == bfd_link_hash_indirect
       && dir->got.refcount <= 0)
@@ -2687,7 +2684,7 @@ csky_elf_check_relocs (bfd * abfd,
                      || (ELF32_R_TYPE (rel->r_info)
                          == R_CKCORE_PCREL_JSR_IMM11BY2))
                    eh->jsri2bsr_refcount += 1;
-                 head = &eh->dyn_relocs;
+                 head = &h->dyn_relocs;
                }
              else
                {
This page took 0.025234 seconds and 4 git commands to generate.