Delete _bdf_ecoff_archive_p

Alan Modra amodra@bigpond.net.au
Tue Jan 22 16:17:00 GMT 2008


This patch removes _bdf_ecoff_archive_p, which is virtually a copy of
bfd_generic_archive_p.  The differences are that the generic function
has a bug fix and allows b.out archives, and the ecoff version calls
its slurp_armap and slurp_extended_name_table directly rather than
via BFD_SEND.  ie. the only practical difference is allowing b.out
archives.  I don't think that warrants a separate function.

	* ecoff.c (_bfd_ecoff_archive_p): Delete.
	* libecoff.h (_bfd_ecoff_archive_p): Delete.
	* coff-alpha.c (ecoffalpha_little_vec): Use bfd_generic_archive_p.
	* coff-mips.c (ecoff_little_vec, ecoff_big_vec): Likewise.
	(ecoff_biglittle_vec): Likewise.

Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.58
diff -u -p -r1.58 ecoff.c
--- bfd/ecoff.c	15 Dec 2007 09:34:48 -0000	1.58
+++ bfd/ecoff.c	19 Jan 2008 13:02:34 -0000
@@ -3154,89 +3154,6 @@ _bfd_ecoff_write_armap (bfd *abfd,
 
   return TRUE;
 }
-
-/* See whether this BFD is an archive.  If it is, read in the armap
-   and the extended name table.  */
-
-const bfd_target *
-_bfd_ecoff_archive_p (bfd *abfd)
-{
-  struct artdata *tdata_hold;
-  char armag[SARMAG + 1];
-  bfd_size_type amt;
-
-  if (bfd_bread ((void *) armag, (bfd_size_type) SARMAG, abfd) != SARMAG)
-    {
-      if (bfd_get_error () != bfd_error_system_call)
-	bfd_set_error (bfd_error_wrong_format);
-      return NULL;
-    }
-
-  if (! strneq (armag, ARMAG, SARMAG))
-    {
-      bfd_set_error (bfd_error_wrong_format);
-      return NULL;
-    }
-
-  tdata_hold = bfd_ardata (abfd);
-
-  amt = sizeof (struct artdata);
-  bfd_ardata (abfd) = bfd_zalloc (abfd, amt);
-  if (bfd_ardata (abfd) == NULL)
-    {
-      bfd_ardata (abfd) = tdata_hold;
-      return NULL;
-    }
-
-  bfd_ardata (abfd)->first_file_filepos = SARMAG;
-  /* 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))
-    {
-      bfd_release (abfd, bfd_ardata (abfd));
-      bfd_ardata (abfd) = tdata_hold;
-      return NULL;
-    }
-
-  if (bfd_has_map (abfd))
-    {
-      bfd *first;
-
-      /* This archive has a map, so we may presume that the contents
-	 are object files.  Make sure that if the first file in the
-	 archive can be recognized as an object file, it is for this
-	 target.  If not, assume that this is the wrong format.  If
-	 the first file is not an object file, somebody is doing
-	 something weird, and we permit it so that ar -t will work.  */
-
-      first = bfd_openr_next_archived_file (abfd, NULL);
-      if (first != NULL)
-	{
-	  first->target_defaulted = FALSE;
-	  if (bfd_check_format (first, bfd_object)
-	      && first->xvec != abfd->xvec)
-	    {
-	      /* We ought to close `first' here, but we can't, because
-		 we have no way to remove it from the archive cache.
-		 It's almost impossible to figure out when we can
-		 release bfd_ardata.  FIXME.  */
-	      bfd_set_error (bfd_error_wrong_object_format);
-	      bfd_ardata (abfd) = tdata_hold;
-	      return NULL;
-	    }
-	  /* And we ought to close `first' here too.  */
-	}
-    }
-
-  return abfd->xvec;
-}
 
 /* ECOFF linker code.  */
 
Index: bfd/libecoff.h
===================================================================
RCS file: /cvs/src/src/bfd/libecoff.h,v
retrieving revision 1.23
diff -u -p -r1.23 libecoff.h
--- bfd/libecoff.h	3 Jul 2007 14:26:42 -0000	1.23
+++ bfd/libecoff.h	19 Jan 2008 13:02:43 -0000
@@ -229,7 +229,6 @@ extern bfd_boolean _bfd_ecoff_slurp_symb
 /* Generic ECOFF BFD backend vectors.  */
 
 extern bfd_boolean _bfd_ecoff_write_object_contents (bfd *);
-extern const bfd_target *_bfd_ecoff_archive_p (bfd *);
 
 #define	_bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup
 #define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
Index: bfd/coff-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-alpha.c,v
retrieving revision 1.36
diff -u -p -r1.36 coff-alpha.c
--- bfd/coff-alpha.c	3 Jul 2007 14:26:39 -0000	1.36
+++ bfd/coff-alpha.c	19 Jan 2008 13:02:30 -0000
@@ -2421,7 +2421,7 @@ const bfd_target ecoffalpha_little_vec =
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
   {_bfd_dummy_target, alpha_ecoff_object_p, /* bfd_check_format */
-     _bfd_ecoff_archive_p, _bfd_dummy_target},
+     bfd_generic_archive_p, _bfd_dummy_target},
   {bfd_false, _bfd_ecoff_mkobject,  /* bfd_set_format */
      _bfd_generic_mkarchive, bfd_false},
   {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
Index: bfd/coff-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-mips.c,v
retrieving revision 1.33
diff -u -p -r1.33 coff-mips.c
--- bfd/coff-mips.c	3 Jul 2007 14:26:39 -0000	1.33
+++ bfd/coff-mips.c	19 Jan 2008 13:02:33 -0000
@@ -1441,7 +1441,7 @@ const bfd_target ecoff_little_vec =
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
   {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-     _bfd_ecoff_archive_p, _bfd_dummy_target},
+     bfd_generic_archive_p, _bfd_dummy_target},
   {bfd_false, _bfd_ecoff_mkobject,  /* bfd_set_format */
      _bfd_generic_mkarchive, bfd_false},
   {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
@@ -1484,7 +1484,7 @@ const bfd_target ecoff_big_vec =
      bfd_getb32, bfd_getb_signed_32, bfd_putb32,
      bfd_getb16, bfd_getb_signed_16, bfd_putb16,
  {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-    _bfd_ecoff_archive_p, _bfd_dummy_target},
+    bfd_generic_archive_p, _bfd_dummy_target},
  {bfd_false, _bfd_ecoff_mkobject, /* bfd_set_format */
     _bfd_generic_mkarchive, bfd_false},
  {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */
@@ -1528,7 +1528,7 @@ const bfd_target ecoff_biglittle_vec =
      bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
 
   {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
-     _bfd_ecoff_archive_p, _bfd_dummy_target},
+     bfd_generic_archive_p, _bfd_dummy_target},
   {bfd_false, _bfd_ecoff_mkobject,  /* bfd_set_format */
      _bfd_generic_mkarchive, bfd_false},
   {bfd_false, _bfd_ecoff_write_object_contents, /* bfd_write_contents */

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list