bfd:
[deliverable/binutils-gdb.git] / bfd / ecoff.c
index 2cc3b52db600c545cc3f29d5f80b3a28e8232c7a..cf2658a4c9bf07a2ec4e35a2926f5f4ec34ea5a3 100644 (file)
@@ -18,7 +18,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -54,12 +54,12 @@ static asection bfd_debug_section =
 {
   /* name,      id,  index, next, prev, flags, user_set_vma,       */
      "*DEBUG*", 0,   0,     NULL, NULL, 0,     0,
-  /* linker_mark, linker_has_input, gc_mark, segment_mark,         */
-     0,           0,                0,       0,
-  /* sec_info_type, use_rela_p, has_tls_reloc, has_gp_reloc,       */
-     0,                    0,          0,             0,
-  /* need_finalize_relax, reloc_done,                              */
-     0,                          0,
+  /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh,      */
+     0,           0,                1,       0,
+  /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc,       */
+     0,            0,             0,          0,
+  /* has_gp_reloc, need_finalize_relax, reloc_done,                */
+     0,            0,                   0,
   /* vma, lma, size, rawsize,                                      */
      0,   0,   0,    0,
   /* output_offset, output_section, alignment_power,               */
@@ -68,7 +68,7 @@ static asection bfd_debug_section =
      NULL,       NULL,        0,           0,       0,
   /* line_filepos, userdata, contents, lineno, lineno_count,       */
      0,            NULL,     NULL,     NULL,   0,
-  /* entsize, kept_section, moving_line_filepos,                  */
+  /* entsize, kept_section, moving_line_filepos,                   */
      0,       NULL,         0,
   /* target_index, used_by_bfd, constructor_chain, owner,          */
      0,            NULL,        NULL,              NULL,
@@ -76,8 +76,8 @@ static asection bfd_debug_section =
      NULL,
   /* symbol_ptr_ptr,                                               */
      NULL,
-  /* link_order_head, link_order_tail                              */
-     NULL,            NULL
+  /* map_head, map_tail                                            */
+     { NULL }, { NULL }
 };
 
 /* Create an ECOFF object.  */
@@ -2633,6 +2633,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
          reloc_ptr_ptr = current->orelocation;
          reloc_end = reloc_ptr_ptr + current->reloc_count;
          out_ptr = (char *) reloc_buff;
+
          for (;
               reloc_ptr_ptr < reloc_end;
               reloc_ptr_ptr++, out_ptr += external_reloc_size)
@@ -2646,6 +2647,11 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
              reloc = *reloc_ptr_ptr;
              sym = *reloc->sym_ptr_ptr;
 
+             /* If the howto field has not been initialised then skip this reloc.
+                This assumes that an error message has been issued elsewhere.  */
+             if (reloc->howto == NULL)
+               continue;
+
              in.r_vaddr = (reloc->address
                            + bfd_get_section_vma (abfd, current));
              in.r_type = reloc->howto->type;
@@ -3182,11 +3188,13 @@ _bfd_ecoff_archive_p (bfd *abfd)
     }
 
   bfd_ardata (abfd)->first_file_filepos = SARMAG;
-  bfd_ardata (abfd)->cache = NULL;
-  bfd_ardata (abfd)->archive_head = NULL;
-  bfd_ardata (abfd)->symdefs = NULL;
-  bfd_ardata (abfd)->extended_names = NULL;
-  bfd_ardata (abfd)->tdata = NULL;
+  /* Already cleared by bfd_zalloc above.
+     bfd_ardata (abfd)->cache = NULL;
+     bfd_ardata (abfd)->archive_head = NULL;
+     bfd_ardata (abfd)->symdefs = NULL;
+     bfd_ardata (abfd)->extended_names = NULL;
+     bfd_ardata (abfd)->extended_names_size = 0;
+     bfd_ardata (abfd)->tdata = NULL;  */
 
   if (! _bfd_ecoff_slurp_armap (abfd)
       || ! _bfd_ecoff_slurp_extended_name_table (abfd))
@@ -4523,7 +4531,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
       for (o = abfd->sections; o != NULL; o = o->next)
        {
          o->reloc_count = 0;
-         for (p = o->link_order_head;
+         for (p = o->map_head.link_order;
               p != NULL;
               p = p->next)
            if (p->type == bfd_indirect_link_order)
@@ -4593,7 +4601,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
 
   for (o = abfd->sections; o != NULL; o = o->next)
     {
-      for (p = o->link_order_head;
+      for (p = o->map_head.link_order;
           p != NULL;
           p = p->next)
        {
This page took 0.029708 seconds and 4 git commands to generate.