PR26069, strip/objcopy misaligned address accesses
[deliverable/binutils-gdb.git] / bfd / elf32-microblaze.c
index bccb0afcf4fa70ccece75802571573dae74352ef..928098d2be20460e6abada66f9c880f5b65c5c71 100644 (file)
@@ -721,9 +721,6 @@ struct elf32_mb_link_hash_entry
 {
   struct elf_link_hash_entry elf;
 
-  /* Track dynamic relocs copied for this symbol.  */
-  struct elf_dyn_relocs *dyn_relocs;
-
   /* TLS Reference Types for the symbol; Updated by check_relocs */
 #define TLS_GD     1  /* GD reloc. */
 #define TLS_LD     2  /* LD reloc. */
@@ -790,7 +787,6 @@ link_hash_newfunc (struct bfd_hash_entry *entry,
       struct elf32_mb_link_hash_entry *eh;
 
       eh = (struct elf32_mb_link_hash_entry *) entry;
-      eh->dyn_relocs = NULL;
       eh->tls_mask = 0;
     }
 
@@ -2234,11 +2230,8 @@ microblaze_elf_relax_section (bfd *abfd,
       symtab_hdr->contents = (bfd_byte *) isymbuf;
     }
 
-  if (free_relocs != NULL)
-    {
-      free (free_relocs);
-      free_relocs = NULL;
-    }
+  free (free_relocs);
+  free_relocs = NULL;
 
   if (free_contents != NULL)
     {
@@ -2261,16 +2254,11 @@ microblaze_elf_relax_section (bfd *abfd,
   return TRUE;
 
  error_return:
-  if (free_relocs != NULL)
-    free (free_relocs);
-  if (free_contents != NULL)
-    free (free_contents);
-  if (sec->relax != NULL)
-    {
-      free (sec->relax);
-      sec->relax = NULL;
-      sec->relax_count = 0;
-    }
+  free (free_relocs);
+  free (free_contents);
+  free (sec->relax);
+  sec->relax = NULL;
+  sec->relax_count = 0;
   return FALSE;
 }
 
@@ -2524,7 +2512,7 @@ microblaze_elf_check_relocs (bfd * abfd,
                /* If this is a global symbol, we count the number of
                   relocations we need for this symbol.  */
                if (h != NULL)
-                 head = &((struct elf32_mb_link_hash_entry *) h)->dyn_relocs;
+                 head = &h->dyn_relocs;
                else
                  {
                    /* Track dynamic relocs needed for local syms too.
@@ -2587,9 +2575,9 @@ 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 (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;
@@ -2599,11 +2587,11 @@ microblaze_elf_copy_indirect_symbol (struct bfd_link_info *info,
 
          /* Add reloc counts against the weak sym to the strong 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;
@@ -2614,11 +2602,11 @@ microblaze_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;
     }
 
   edir->tls_mask |= eind->tls_mask;
@@ -2633,7 +2621,7 @@ readonly_dynrelocs (struct elf_link_hash_entry *h)
 {
   struct elf_dyn_relocs *p;
 
-  for (p = elf32_mb_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;
 
@@ -2906,7 +2894,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
   else
     h->got.offset = (bfd_vma) -1;
 
-  if (eh->dyn_relocs == NULL)
+  if (h->dyn_relocs == NULL)
     return TRUE;
 
   /* In the shared -Bsymbolic case, discard space allocated for
@@ -2923,7 +2911,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
        {
          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;
@@ -2934,7 +2922,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
            }
        }
       else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
-       eh->dyn_relocs = NULL;
+       h->dyn_relocs = NULL;
     }
   else
     {
@@ -2964,13 +2952,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
            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 *sreloc = elf_section_data (p->sec)->sreloc;
       sreloc->size += p->count * sizeof (Elf32_External_Rela);
This page took 0.040354 seconds and 4 git commands to generate.