daily update
[deliverable/binutils-gdb.git] / bfd / elf32-hppa.c
index a9d04f078e44c735a68c3d71d678df51a4c96aee..85352aaf9dcc1ced04825edaa65bb4202923ecb5 100644 (file)
@@ -1004,7 +1004,7 @@ elf32_hppa_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-elf32_hppa_copy_indirect_symbol (const struct elf_backend_data *bed,
+elf32_hppa_copy_indirect_symbol (struct bfd_link_info *info,
                                 struct elf_link_hash_entry *eh_dir,
                                 struct elf_link_hash_entry *eh_ind)
 {
@@ -1020,16 +1020,15 @@ elf32_hppa_copy_indirect_symbol (const struct elf_backend_data *bed,
          struct elf32_hppa_dyn_reloc_entry **hdh_pp;
          struct elf32_hppa_dyn_reloc_entry *hdh_p;
 
-         if (eh_ind->root.type == bfd_link_hash_indirect)
-           abort ();
-
-         /* Add reloc counts against the weak sym to the strong sym
+         /* Add reloc counts against the indirect sym to the direct sym
             list.  Merge any entries against the same section.  */
          for (hdh_pp = &hh_ind->dyn_relocs; (hdh_p = *hdh_pp) != NULL; )
            {
              struct elf32_hppa_dyn_reloc_entry *hdh_q;
 
-             for (hdh_q = hh_dir->dyn_relocs; hdh_q != NULL; hdh_q = hdh_q->hdh_next)
+             for (hdh_q = hh_dir->dyn_relocs;
+                  hdh_q != NULL;
+                  hdh_q = hdh_q->hdh_next)
                if (hdh_q->sec == hdh_p->sec)
                  {
 #if RELATIVE_DYNRELOCS
@@ -1062,7 +1061,7 @@ elf32_hppa_copy_indirect_symbol (const struct elf_backend_data *bed,
       eh_dir->needs_plt |= eh_ind->needs_plt;
     }
   else
-   _bfd_elf_link_hash_copy_indirect (bed, eh_dir, eh_ind);
+   _bfd_elf_link_hash_copy_indirect (info, eh_dir, eh_ind);
 }
 
 /* Look through the relocs for a section during the first phase, and
@@ -1446,13 +1445,15 @@ elf32_hppa_check_relocs (bfd *abfd,
                     easily.  Oh well.  */
 
                  asection *sr;
+                 void *vpp;
+
                  sr = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
                                                       sec, r_symndx);
                  if (sr == NULL)
                    return FALSE;
 
-                 hdh_head = ((struct elf32_hppa_dyn_reloc_entry **)
-                         &elf_section_data (sr)->local_dynrel);
+                 vpp = &elf_section_data (sr)->local_dynrel;
+                 hdh_head = (struct elf32_hppa_dyn_reloc_entry **) vpp;
                }
 
              hdh_p = *hdh_head;
@@ -1807,6 +1808,13 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
        }
     }
 
+  if (eh->size == 0)
+    {
+      (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+                            eh->root.root.string);
+      return TRUE;
+    }
+
   /* We must allocate the symbol in our .dynbss section, which will
      become part of the .bss section of the executable.  There will be
      an entry for this symbol in the .dynsym section.  The dynamic
@@ -2274,7 +2282,8 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
              sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask;
            }
        }
-      else if (sec == htab->sgot)
+      else if (sec == htab->sgot
+              || sec == htab->sdynbss)
        ;
       else if (strncmp (bfd_get_section_name (dynobj, sec), ".rela", 5) == 0)
        {
@@ -2311,10 +2320,13 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          continue;
        }
 
+      if ((sec->flags & SEC_HAS_CONTENTS) == 0)
+       continue;
+
       /* Allocate memory for the section contents.  Zero it, because
         we may not fill in all the reloc sections.  */
       sec->contents = bfd_zalloc (dynobj, sec->size);
-      if (sec->contents == NULL && sec->size != 0)
+      if (sec->contents == NULL)
        return FALSE;
     }
 
@@ -2335,7 +2347,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
         must add the entries now so that we get the correct size for
         the .dynamic section.  The DT_DEBUG entry is filled in by the
         dynamic linker and used by the debugger.  */
-      if (!info->shared)
+      if (info->executable)
        {
          if (!add_dynamic_entry (DT_DEBUG, 0))
            return FALSE;
@@ -4247,6 +4259,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
 #define elf_backend_post_process_headers     elf32_hppa_post_process_headers
 #define elf_backend_get_symbol_type         elf32_hppa_elf_get_symbol_type
 #define elf_backend_reloc_type_class        elf32_hppa_reloc_type_class
+#define elf_backend_action_discarded        elf_hppa_action_discarded
 
 #define elf_backend_can_gc_sections         1
 #define elf_backend_can_refcount            1
This page took 0.024335 seconds and 4 git commands to generate.