bfd_check_format: ignore errors from coff_real_object_p
authorAlan Modra <amodra@gmail.com>
Mon, 6 Jan 2020 09:21:22 +0000 (19:51 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 6 Jan 2020 11:23:51 +0000 (21:53 +1030)
Since 1993-11-05 git commit c188b0bec3b, bfd_check_format has failed
if any of the target object_p functions returns false with any error
but bfd_error_wrong_format.  That's just weird.  There is really no
reason why coff_real_object_p should be fixed to only return that
error instead of numerous other possible errors.  Even an out of
memory condition for one target doesn't necessarily mean other targets
can't match, assuming the failing target nicely returns all memory it
might have used.

* format.c (bfd_check_format_matches): Ignore bfd_error on target
match failures.  Don't init to bfd_error_wrong_format before
calling _bfd_check_format.

bfd/ChangeLog
bfd/format.c

index 4fc134503688bd879c8f3d9652c6c5da1ef35bd6..97c9309616d50c285710acfdcec13691725182b1 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-06  Alan Modra  <amodra@gmail.com>
+
+       * format.c (bfd_check_format_matches): Ignore bfd_error on target
+       match failures.  Don't init to bfd_error_wrong_format before
+       calling _bfd_check_format.
+
 2020-01-06  Alan Modra  <amodra@gmail.com>
 
        * vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
index e53955eb45878dda7a1303bd421084490ba4ca2e..a80a175b8ae90b9c377a9f0bd5a3d578c1d36ec0 100644 (file)
@@ -325,12 +325,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
       if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
        goto err_ret;
 
-      /* If _bfd_check_format neglects to set bfd_error, assume
-        bfd_error_wrong_format.  We didn't used to even pay any
-        attention to bfd_error, so I suspect that some
-        _bfd_check_format might have this problem.  */
-      bfd_set_error (bfd_error_wrong_format);
-
       temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
       if (temp)
        {
@@ -389,8 +383,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
                goto err_ret;
            }
        }
-      else if (bfd_get_error () != bfd_error_wrong_format)
-       goto err_ret;
     }
 
   if (best_count == 1)
This page took 0.025662 seconds and 4 git commands to generate.