Avoid testcase build failures with -Wunused-value
[deliverable/binutils-gdb.git] / bfd / elf32-nios2.c
index 6b4b092e2df5fa20e62e74a806946c8ffc88b0df..cdc11f97159810584216c31ccc1695c965b8148b 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)
     {
@@ -5783,8 +5752,6 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
                {
                  srel = elf_section_data (p->sec)->sreloc;
                  srel->size += p->count * sizeof (Elf32_External_Rela);
-                 if ((p->sec->output_section->flags & SEC_READONLY) != 0)
-                   info->flags |= DF_TEXTREL;
                }
            }
        }
@@ -5933,17 +5900,24 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
              || !add_dynamic_entry (DT_JMPREL, 0)))
        return FALSE;
 
-      if (relocs
-         && (!add_dynamic_entry (DT_RELA, 0)
+      if (relocs)
+       {
+         if (!add_dynamic_entry (DT_RELA, 0)
              || !add_dynamic_entry (DT_RELASZ, 0)
-             || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))))
-       return FALSE;
+             || !add_dynamic_entry (DT_RELAENT,
+                                    sizeof (Elf32_External_Rela)))
+           return FALSE;
 
-      if (!bfd_link_pic (info) && !add_dynamic_entry (DT_NIOS2_GP, 0))
-       return FALSE;
+         if ((info->flags & DF_TEXTREL) == 0)
+           elf_link_hash_traverse (&htab->root,
+                                   _bfd_elf_maybe_set_textrel, info);
+
+         if ((info->flags & DF_TEXTREL) != 0
+             && !add_dynamic_entry (DT_TEXTREL, 0))
+           return FALSE;
+       }
 
-      if ((info->flags & DF_TEXTREL) != 0
-         && !add_dynamic_entry (DT_TEXTREL, 0))
+      if (!bfd_link_pic (info) && !add_dynamic_entry (DT_NIOS2_GP, 0))
        return FALSE;
     }
 #undef add_dynamic_entry
This page took 0.023355 seconds and 4 git commands to generate.