From 66cd82b52e17203d61af21f50593aa8b33baaf56 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 21 Jan 2008 03:48:10 +0000 Subject: [PATCH] * 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. --- bfd/ChangeLog | 8 +++++ bfd/coff-alpha.c | 4 +-- bfd/coff-mips.c | 8 ++--- bfd/ecoff.c | 85 +----------------------------------------------- bfd/libecoff.h | 3 +- 5 files changed, 16 insertions(+), 92 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4a67372918..59f8347dd5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2008-01-21 Alan Modra + + * 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. + 2008-01-19 Alan Modra PR 5646 diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 4799fdf0ff..52235f79f9 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1,6 +1,6 @@ /* BFD back-end for ALPHA Extended-Coff files. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2007 Free Software Foundation, Inc. + 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain and Ian Lance Taylor . @@ -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 */ diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 6b01d44ec9..38010ef821 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS Extended-Coff files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2007 + 2000, 2001, 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -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 */ diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 149df6455e..ead1f9bb2a 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1,6 +1,6 @@ /* Generic ECOFF (Extended-COFF) routines. Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -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. */ diff --git a/bfd/libecoff.h b/bfd/libecoff.h index 9c4161ce36..443b9a756f 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -1,6 +1,6 @@ /* BFD ECOFF object file private structure. Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -229,7 +229,6 @@ extern bfd_boolean _bfd_ecoff_slurp_symbolic_info /* 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 -- 2.34.1