aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-09-12 16:23:25 +0000
committerIan Lance Taylor <ian@airs.com>1995-09-12 16:23:25 +0000
commitae115e5114deb0326333c80f7af9e689b2e7d01f (patch)
tree2c592646411768ec9a95b17070181cb5b068cf9c /bfd/archive.c
parentd8586e35caeb6ffea7058bce844023ec19140cc7 (diff)
downloadfsf-binutils-gdb-ae115e5114deb0326333c80f7af9e689b2e7d01f.zip
fsf-binutils-gdb-ae115e5114deb0326333c80f7af9e689b2e7d01f.tar.gz
fsf-binutils-gdb-ae115e5114deb0326333c80f7af9e689b2e7d01f.tar.bz2
Extensive minor changes to avoid various gcc warnings. Also:
* Makefile.in (BFD32_BACKENDS): Remove coff-arm.o. * archures.c (bfd_arch_info_type): Change mach field from long to unsigned long. (bfd_lookup_arch): Change machine parameter from long to unsigned long.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 44cad84..fbf5bec 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -16,7 +16,7 @@ GNU General Public License for more details.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
@setfilename archive-info
@@ -677,6 +677,40 @@ bfd_generic_archive_p (abfd)
return NULL;
}
+ if (bfd_has_map (abfd) && abfd->target_defaulted)
+ {
+ bfd *first;
+
+ /* This archive has a map, so we may presume that the contents
+ are object files. Make sure that the first file in the
+ archive can be recognized as an object file for this target.
+ If not, assume that this is the wrong format.
+
+ This is done because any normal format will recognize any
+ normal archive, regardless of the format of the object files.
+ We do accept an empty archive. */
+
+ first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
+ if (first != NULL)
+ {
+ first->target_defaulted = false;
+ if (! bfd_check_format (first, bfd_object))
+ {
+ bfd_error_type err;
+
+ err = bfd_get_error ();
+ (void) bfd_close (first);
+ bfd_release (abfd, bfd_ardata (abfd));
+ abfd->tdata.aout_ar_data = NULL;
+ bfd_set_error (err);
+ return NULL;
+ }
+
+ /* We ought to close first here, but we can't, because we
+ have no way to remove it from the archive cache. FIXME. */
+ }
+ }
+
return abfd->xvec;
}
@@ -1450,9 +1484,9 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr)
intel's release is out the door. */
struct ar_hdr *hdr = (struct ar_hdr *) arhdr;
- int length;
+ size_t length;
const char *filename;
- int maxlen = ar_maxnamelen (abfd);
+ size_t maxlen = ar_maxnamelen (abfd);
if ((bfd_get_file_flags (abfd) & BFD_TRADITIONAL_FORMAT) != 0)
{
@@ -1871,7 +1905,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
bfd *current = arch->archive_head;
bfd *last_elt = current; /* last element arch seen */
bfd_byte temp[4];
- int count;
+ unsigned int count;
struct ar_hdr hdr;
struct stat statbuf;
unsigned int i;
@@ -1957,7 +1991,7 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
{
struct stat archstat;
struct ar_hdr hdr;
- int i;
+ unsigned int i;
/* Flush writes, get last-write timestamp from file, and compare it
to the timestamp IN the file. */
@@ -2024,7 +2058,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx)
unsigned int mapsize = stringsize + ranlibsize;
file_ptr archive_member_file_ptr;
bfd *current = arch->archive_head;
- int count;
+ unsigned int count;
struct ar_hdr hdr;
unsigned int i;
int padit = mapsize & 1;