aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-01-28 07:58:16 +0000
committerAlan Modra <amodra@gmail.com>2013-01-28 07:58:16 +0000
commit89d7b8aa6b05d68d2303f6ca7582947b8ad8fb0e (patch)
tree07f85854fa1e3147560dd75bfb2aeb9984a68106 /bfd
parent616e8b71634921d6ac5c425a59f9c33936147d65 (diff)
downloadgdb-89d7b8aa6b05d68d2303f6ca7582947b8ad8fb0e.zip
gdb-89d7b8aa6b05d68d2303f6ca7582947b8ad8fb0e.tar.gz
gdb-89d7b8aa6b05d68d2303f6ca7582947b8ad8fb0e.tar.bz2
* archive.c (bfd_generic_archive_p): Return target and keep
ardata on partial matches. * format.c (bfd_check_format_matches): Adjust for above change. Remove bfd_error_file_ambiguously_recognized dead code.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/archive.c6
-rw-r--r--bfd/format.c75
3 files changed, 46 insertions, 43 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b746060..47edd06 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2013-01-28 Alan Modra <amodra@gmail.com>
+
+ * archive.c (bfd_generic_archive_p): Return target and keep
+ ardata on partial matches.
+ * format.c (bfd_check_format_matches): Adjust for above
+ change. Remove bfd_error_file_ambiguously_recognized dead
+ code.
+
2013-01-26 Alan Modra <amodra@gmail.com>
* bfd.c (struct bfd_preserve, bfd_preserve_save, bfd_preserve_restore,
diff --git a/bfd/archive.c b/bfd/archive.c
index be0f562..e4183ea 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -852,11 +852,7 @@ bfd_generic_archive_p (bfd *abfd)
first->target_defaulted = FALSE;
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
- {
- bfd_set_error (bfd_error_wrong_object_format);
- bfd_ardata (abfd) = tdata_hold;
- return NULL;
- }
+ bfd_set_error (bfd_error_wrong_object_format);
/* And we ought to close `first' here too. */
}
}
diff --git a/bfd/format.c b/bfd/format.c
index 36eeb85..e2afa3b 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -279,7 +279,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
for (target = bfd_target_vector; *target != NULL; target++)
{
const bfd_target *temp;
- bfd_error_type err;
/* Don't check the default target twice. */
if (*target == &binary_vec
@@ -310,47 +309,47 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
match_targ = temp;
if (preserve.marker != NULL)
bfd_preserve_finish (abfd, &preserve);
- }
-
- if (temp && (abfd->format != bfd_archive || bfd_has_map (abfd)))
- {
- /* This format checks out as ok! */
- right_targ = temp;
-
- /* If this is the default target, accept it, even if other
- targets might match. People who want those other targets
- have to set the GNUTARGET variable. */
- if (temp == bfd_default_vector[0])
- goto ok_ret;
- if (matching_vector)
- matching_vector[match_count] = temp;
- match_count++;
-
- if (temp->match_priority < best_match)
+ if (abfd->format != bfd_archive
+ || (bfd_has_map (abfd)
+ && bfd_get_error () != bfd_error_wrong_object_format))
{
- best_match = temp->match_priority;
- best_count = 0;
+ /* This format checks out as ok! */
+ right_targ = temp;
+
+ /* If this is the default target, accept it, even if
+ other targets might match. People who want those
+ other targets have to set the GNUTARGET variable. */
+ if (temp == bfd_default_vector[0])
+ goto ok_ret;
+
+ if (matching_vector)
+ matching_vector[match_count] = temp;
+ match_count++;
+
+ if (temp->match_priority < best_match)
+ {
+ best_match = temp->match_priority;
+ best_count = 0;
+ }
+ best_count++;
+ }
+ else
+ {
+ /* An archive with no armap or objects of the wrong
+ type. We want this target to match if we get no
+ better matches. */
+ if (ar_right_targ != bfd_default_vector[0])
+ ar_right_targ = *target;
+ if (matching_vector)
+ matching_vector[ar_match_index] = *target;
+ ar_match_index++;
}
- best_count++;
- }
- else if (temp
- || (err = bfd_get_error ()) == bfd_error_wrong_object_format
- || err == bfd_error_file_ambiguously_recognized)
- {
- /* An archive with no armap or objects of the wrong type,
- or an ambiguous match. We want this target to match
- if we get no better matches. */
- if (ar_right_targ != bfd_default_vector[0])
- ar_right_targ = *target;
- if (matching_vector)
- matching_vector[ar_match_index] = *target;
- ar_match_index++;
- }
- else if (err != bfd_error_wrong_format)
- goto err_ret;
- if (temp && !bfd_preserve_save (abfd, &preserve))
+ if (!bfd_preserve_save (abfd, &preserve))
+ goto err_ret;
+ }
+ else if (bfd_get_error () != bfd_error_wrong_format)
goto err_ret;
}