Add --info command line switch

This commit is contained in:
Nick Clifton 2003-03-24 16:11:46 +00:00
parent 9418ab9c20
commit 7c29036b75
4 changed files with 57 additions and 7 deletions

View file

@ -1,5 +1,17 @@
2003-03-24 Elias Athanasopoulos <elathan@phys.uoa.gr>
* objcopy (OPTION_FORMATS_INFO): Define.
(strip_options): Add "info"/OPTION_FORMATS_INFO option.
(copy_options): Likewise.
(strip_usage): Add "--info" to usage.
(copy_usage): Likewise.
(strip_main): Declare formats_info. Iniatilize it to FALSE.
Handle "info".
(copy_main). Likewise.
* doc/binutils.texi. Document the "--info" option for
objcopy/strip.
* NEWS: Mention the new command line switch.
* objdump.c (endian_string): Move to bucomm.c.
(display_info): Likewise.
(display_target_list): Likewise.

View file

@ -1,5 +1,7 @@
-*- text -*-
* Added --info switch to objcopy and strip.
* Support for Vitesse IQ2000 added by Red Hat.
* Added 'S' encoding to strings to allow the display of 8-bit characters.

View file

@ -970,7 +970,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
[@option{--prefix-alloc-sections=}@var{string}]
[@option{-v}|@option{--verbose}]
[@option{-V}|@option{--version}]
[@option{--help}]
[@option{--help}] [@option{--info}]
@var{infile} [@var{outfile}]
@c man end
@end smallexample
@ -1348,6 +1348,9 @@ archives, @samp{objcopy -V} lists all members of the archive.
@item --help
Show a summary of the options to @command{objcopy}.
@item --info
Display a list showing all architectures and object formats available.
@end table
@c man end
@ -2051,7 +2054,8 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname} ]
[@option{-x}|@option{--discard-all} ] [@option{-X} |@option{--discard-locals}]
[@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname} ]
[@option{-o} @var{file} ] [@option{-p}|@option{--preserve-dates}]
[@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}] [@option{--help}]
[@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
[@option{--help}] [@option{--info}]
@var{objfile}@dots{}
@c man end
@end smallexample
@ -2079,6 +2083,9 @@ code format @var{bfdname}, and rewrite it in the same format.
@item --help
Show a summary of the options to @command{strip} and exit.
@item --info
Display a list showing all architectures and object formats available.
@item -I @var{bfdname}
@itemx --input-target=@var{bfdname}
Treat the original @var{objfile} as a file with the object

View file

@ -275,6 +275,7 @@ static char *prefix_alloc_sections_string = 0;
#define OPTION_PREFIX_SYMBOLS (OPTION_ALT_MACH_CODE + 1)
#define OPTION_PREFIX_SECTIONS (OPTION_PREFIX_SYMBOLS + 1)
#define OPTION_PREFIX_ALLOC_SECTIONS (OPTION_PREFIX_SECTIONS + 1)
#define OPTION_FORMATS_INFO (OPTION_PREFIX_ALLOC_SECTIONS + 1)
/* Options to handle if running as "strip". */
@ -284,6 +285,7 @@ static struct option strip_options[] =
{"discard-locals", no_argument, 0, 'X'},
{"format", required_argument, 0, 'F'}, /* Obsolete */
{"help", no_argument, 0, 'h'},
{"info", no_argument, 0, OPTION_FORMATS_INFO},
{"input-format", required_argument, 0, 'I'}, /* Obsolete */
{"input-target", required_argument, 0, 'I'},
{"keep-symbol", required_argument, 0, 'K'},
@ -327,6 +329,7 @@ static struct option copy_options[] =
{"format", required_argument, 0, 'F'}, /* Obsolete */
{"gap-fill", required_argument, 0, OPTION_GAP_FILL},
{"help", no_argument, 0, 'h'},
{"info", no_argument, 0, OPTION_FORMATS_INFO},
{"input-format", required_argument, 0, 'I'}, /* Obsolete */
{"input-target", required_argument, 0, 'I'},
{"interleave", required_argument, 0, 'i'},
@ -457,6 +460,7 @@ copy_usage (stream, exit_status)
-v --verbose List all object files modified\n\
-V --version Display this program's version number\n\
-h --help Display this output\n\
--info List object formats & architectures supported\n\
"));
list_supported_targets (program_name, stream);
if (exit_status == 0)
@ -488,6 +492,7 @@ strip_usage (stream, exit_status)
-v --verbose List all object files modified\n\
-V --version Display this program's version number\n\
-h --help Display this output\n\
--info List object formats & architectures supported\n\
-o <file> Place stripped output into <file>\n\
"));
@ -2081,9 +2086,12 @@ strip_main (argc, argv)
int argc;
char *argv[];
{
char *input_target = NULL, *output_target = NULL;
char *input_target = NULL;
char *output_target = NULL;
bfd_boolean show_version = FALSE;
int c, i;
bfd_boolean formats_info = FALSE;
int c;
int i;
struct section_list *p;
char *output_file = NULL;
@ -2141,6 +2149,9 @@ strip_main (argc, argv)
case 'V':
show_version = TRUE;
break;
case OPTION_FORMATS_INFO:
formats_info = TRUE;
break;
case 0:
/* We've been given a long option. */
break;
@ -2152,6 +2163,12 @@ strip_main (argc, argv)
}
}
if (formats_info)
{
display_info ();
return 0;
}
if (show_version)
print_version ("strip");
@ -2214,10 +2231,13 @@ copy_main (argc, argv)
char *argv[];
{
char * binary_architecture = NULL;
char *input_filename = NULL, *output_filename = NULL;
char *input_target = NULL, *output_target = NULL;
char *input_filename = NULL;
char *output_filename = NULL;
char *input_target = NULL;
char *output_target = NULL;
bfd_boolean show_version = FALSE;
bfd_boolean change_warn = TRUE;
bfd_boolean formats_info = FALSE;
int c;
struct section_list *p;
struct stat statbuf;
@ -2325,6 +2345,10 @@ copy_main (argc, argv)
show_version = TRUE;
break;
case OPTION_FORMATS_INFO:
formats_info = TRUE;
break;
case OPTION_WEAKEN:
weaken = TRUE;
break;
@ -2659,6 +2683,12 @@ copy_main (argc, argv)
}
}
if (formats_info)
{
display_info ();
return 0;
}
if (show_version)
print_version ("objcopy");
@ -2705,7 +2735,6 @@ copy_main (argc, argv)
/* If there is no destination file then create a temp and rename
the result into the input. */
if (output_filename == (char *) NULL)
{
char *tmpname = make_tempname (input_filename);