Don't mark relocations in excluded sections.
[deliverable/binutils-gdb.git] / bfd / ihex.c
index cee736ace7d84418a26fb4befe52f72084066903..8188c01c89efa08c3cf44a165770e4c3455843ea 100644 (file)
@@ -193,19 +193,16 @@ static boolean
 ihex_mkobject (abfd)
      bfd *abfd;
 {
-  if (abfd->tdata.ihex_data == NULL)
-    {
-      struct ihex_data_struct *tdata;
-      bfd_size_type amt = sizeof (struct ihex_data_struct);
+  struct ihex_data_struct *tdata;
+  bfd_size_type amt = sizeof (struct ihex_data_struct);
 
-      tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
-      if (tdata == NULL)
-       return false;
-      abfd->tdata.ihex_data = tdata;
-      tdata->head = NULL;
-      tdata->tail = NULL;
-    }
+  tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt);
+  if (tdata == NULL)
+    return false;
 
+  abfd->tdata.ihex_data = tdata;
+  tdata->head = NULL;
+  tdata->tail = NULL;
   return true;
 }
 
@@ -513,6 +510,7 @@ static const bfd_target *
 ihex_object_p (abfd)
      bfd *abfd;
 {
+  PTR tdata_save;
   bfd_byte b[9];
   unsigned int i;
   unsigned int type;
@@ -551,9 +549,14 @@ ihex_object_p (abfd)
     }
 
   /* OK, it looks like it really is an Intel Hex file.  */
-  if (! ihex_mkobject (abfd)
-      || ! ihex_scan (abfd))
-    return NULL;
+  tdata_save = abfd->tdata.any;
+  if (! ihex_mkobject (abfd) || ! ihex_scan (abfd))
+    {
+      if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL)
+       bfd_release (abfd, abfd->tdata.any);
+      abfd->tdata.any = tdata_save;
+      return NULL;
+    }
 
   return abfd->xvec;
 }
@@ -977,6 +980,7 @@ ihex_sizeof_headers (abfd, exec)
 #define ihex_bfd_relax_section bfd_generic_relax_section
 #define ihex_bfd_gc_sections bfd_generic_gc_sections
 #define ihex_bfd_merge_sections bfd_generic_merge_sections
+#define ihex_bfd_discard_group bfd_generic_discard_group
 #define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
 #define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
This page took 0.023302 seconds and 4 git commands to generate.