diff options
author | David MacKenzie <djm@cygnus> | 1994-02-03 00:25:30 +0000 |
---|---|---|
committer | David MacKenzie <djm@cygnus> | 1994-02-03 00:25:30 +0000 |
commit | cef35d488209227385e0aa9ab92ebf5a861c3780 (patch) | |
tree | 3e79235f8af64d3e5f7320fbfa578141fc04d8b9 /binutils/objcopy.c | |
parent | b4bd2c92c50c3219a38f24e311688302dc886388 (diff) | |
download | gdb-cef35d488209227385e0aa9ab92ebf5a861c3780.zip gdb-cef35d488209227385e0aa9ab92ebf5a861c3780.tar.gz gdb-cef35d488209227385e0aa9ab92ebf5a861c3780.tar.bz2 |
* nlmconv.c (main), objcopy.c (copy_file): Print matching formats
if ambiguous match.
* nm.c (display_file), size.c (display_bfd): Eliminate gotos.
Print matching formats if there is an ambiguous match. Use
bfd_nonfatal instead of hardcoded error message if nothing matches.
* arsup.c, ar.c, objdump.c: Use bfd_get_filename instead of
abfd->filename.
* nm.c (display_archive): New function, from code in display_file.
(display_rel_file): Renamed from do_one_rel_file.
* size.c: Indent.
(display_archive): New function from code in display_file.
(display_file): Check bfd_close error return.
* strings.c (strings_object_file): Check bfd_check_format
error return.
* strings.c, objdump.c, size.c: Use bfd_nonfatal instead of bfd_perror.
* bucomm.c: Delete references to exit_handler. It wasn't set
anywhere, and now that we're using the libiberty xmalloc, it
wouldn't always get called before exiting.
(list_matching_formats): Function moved from objdump.c.
* bucomm.h: Declare it.
* objdump.c (disassemble_data): Move some variable decls closer to
their use. Add some comments. Replace a nested block with a
return.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 01eb6c0..954abb8 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -390,6 +390,7 @@ copy_file (input_filename, output_filename, input_target, output_target) char *output_target; { bfd *ibfd; + char **matching; /* To allow us to do "strip *" without dying on the first non-object file, failures are nonfatal. */ @@ -400,7 +401,16 @@ copy_file (input_filename, output_filename, input_target, output_target) nonfatal (input_filename); } - if (bfd_check_format (ibfd, bfd_object)) + if (bfd_check_format (ibfd, bfd_archive)) + { + bfd *obfd = bfd_openw (output_filename, output_target); + if (obfd == NULL) + { + nonfatal (output_filename); + } + copy_archive (ibfd, obfd, output_target); + } + else if (bfd_check_format_matches (ibfd, bfd_object, &matching)) { bfd *obfd = bfd_openw (output_filename, output_target); if (obfd == NULL) @@ -420,20 +430,15 @@ copy_file (input_filename, output_filename, input_target, output_target) nonfatal (input_filename); } } - else if (bfd_check_format (ibfd, bfd_archive)) + else { - bfd *obfd = bfd_openw (output_filename, output_target); - if (obfd == NULL) + bfd_nonfatal (input_filename); + if (bfd_error == file_ambiguously_recognized) { - nonfatal (output_filename); + list_matching_formats (matching); + free (matching); } - copy_archive (ibfd, obfd, output_target); - } - else - { - /* Get the right error message. */ - bfd_check_format (ibfd, bfd_object); - nonfatal (input_filename); + status = 1; } } |