(coff_write_object_contents): Initialze link_data if not set.
authorSteve Chamberlain <sac@cygnus>
Tue, 22 Aug 1995 06:54:07 +0000 (06:54 +0000)
committerSteve Chamberlain <sac@cygnus>
Tue, 22 Aug 1995 06:54:07 +0000 (06:54 +0000)
bfd/ChangeLog
bfd/coffcode.h

index 872e320da848a275ccd9de962d544d6f1ee7be9a..dc873051f32ae97e13e9e7b86d4ad04d09619104 100644 (file)
@@ -8,6 +8,7 @@ Mon Aug 21 17:49:28 1995  steve chamberlain  <sac@slash.cygnus.com>
        * coffcode.h (pe_value): New function.
        (fill_pe_header_info): New function.
        (coff_write_object_contents): Use new function.
+       (coff_write_object_contents): Initialze link_data if not set.
        * cofflink.c (coff_final_link_info): Remove pe randomness.
        (dores_com): Update info in bfd_link_pe_info_dval.
        (process_embedded_commands): Use the bfd_link_pe_info_dval.
index 08964fc68f761570a7f6f18222b7a89aa7b09b47..f155ce2dc30ffa704230d4e6ab4ad6fef3a3e640 100644 (file)
@@ -1879,16 +1879,26 @@ coff_write_object_contents (abfd)
 #ifdef COFF_IMAGE_WITH_PE
   struct internal_extra_pe_aouthdr extra_a;
   struct internal_extra_pe_filehdr extra_f;
-
-  bfd_link_pe_info *pe_info = coff_data (abfd)->link_info->pe_info;
   bfd_link_pe_info defs;
+  struct bfd_link_info dummy_info;
+  struct bfd_link_info *info ;
+  struct bfd_link_pe_info *pe_info;
+
+  if (coff_data (abfd)->link_info)
+      info =coff_data (abfd)->link_info;
+  else 
+    {
+      coff_data (abfd)->link_info = info = &dummy_info;
+      info->pe_info = 0;
+    }
+  pe_info = info->pe_info;
+
   if (!pe_info)
     {
       /* Just use sensible defaults */
       memset (&defs, 0, sizeof (defs));
       coff_data (abfd)->link_info->pe_info = &defs;
     }
-
 #endif
 
   bfd_set_error (bfd_error_system_call);