aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2000-03-06 18:08:38 +0000
committerIan Lance Taylor <ian@airs.com>2000-03-06 18:08:38 +0000
commita9998805177cee0fb010d8024dbeeb5eac96367b (patch)
tree2a07d8115f555fd4d086c56e7d96f678e1f2b57a
parentef7904ee590b63740ce8159d01ea7e7e6ad3a8d1 (diff)
downloadgdb-a9998805177cee0fb010d8024dbeeb5eac96367b.zip
gdb-a9998805177cee0fb010d8024dbeeb5eac96367b.tar.gz
gdb-a9998805177cee0fb010d8024dbeeb5eac96367b.tar.bz2
* ldfile.c (ldfile_try_open_bfd): Don't crash if we see an empty
archive.
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/ldfile.c23
2 files changed, 19 insertions, 9 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 11d9cff..9244921 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2000-03-06 Ian Lance Taylor <ian@zembu.com>
+
+ * ldfile.c (ldfile_try_open_bfd): Don't crash if we see an empty
+ archive.
+
2000-03-02 H.J. Lu <hjl@gnu.org>
* emulparams/elf32mcore.sh: Include "getopt.h".
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 187770e..9613c07 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -1,4 +1,6 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 98, 99, 2000 Free Software Foundation, Inc.
+/* Linker file opening and searching.
+ Copyright (C) 1991, 92, 93, 94, 95, 98, 99, 2000
+ Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@@ -129,15 +131,18 @@ ldfile_try_open_bfd (attempt, entry)
else
check = entry->the_bfd;
- if (! bfd_check_format (check, bfd_object))
- return true;
- if (bfd_arch_get_compatible (check, output_bfd) == NULL)
+ if (check != NULL)
{
- einfo (_("%P: skipping incompatible %s when searching for %s"),
- attempt, entry->local_sym_name);
- bfd_close (entry->the_bfd);
- entry->the_bfd = NULL;
- return false;
+ if (! bfd_check_format (check, bfd_object))
+ return true;
+ if (bfd_arch_get_compatible (check, output_bfd) == NULL)
+ {
+ einfo (_("%P: skipping incompatible %s when searching for %s"),
+ attempt, entry->local_sym_name);
+ bfd_close (entry->the_bfd);
+ entry->the_bfd = NULL;
+ return false;
+ }
}
}