Merge changes from gnu/dist/binutils.

This commit is contained in:
tv 2000-08-10 19:53:54 +00:00
parent 9af6ca142f
commit cbef3ca9f3
6 changed files with 52 additions and 26 deletions

View File

@ -157,7 +157,7 @@ list_supported_targets (name, f)
const char *name; const char *name;
FILE *f; FILE *f;
{ {
extern bfd_target *bfd_target_vector[]; extern const bfd_target *const *bfd_target_vector;
int t; int t;
if (name == NULL) if (name == NULL)

View File

@ -1663,7 +1663,7 @@ strip_main (argc, argv)
struct section_list *p; struct section_list *p;
char *output_file = NULL; char *output_file = NULL;
while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpgxXVv", while ((c = getopt_long (argc, argv, "I:O:F:K:N:R:o:sSpdgxXVv",
strip_options, (int *) 0)) != EOF) strip_options, (int *) 0)) != EOF)
{ {
switch (c) switch (c)
@ -1687,6 +1687,7 @@ strip_main (argc, argv)
break; break;
case 'S': case 'S':
case 'g': case 'g':
case 'd':
strip_symbols = STRIP_DEBUG; strip_symbols = STRIP_DEBUG;
break; break;
case OPTION_STRIP_UNNEEDED: case OPTION_STRIP_UNNEEDED:

View File

@ -2626,7 +2626,7 @@ endian_string (endian)
static void static void
display_target_list () display_target_list ()
{ {
extern bfd_target *bfd_target_vector[]; extern const bfd_target *const *bfd_target_vector;
char *dummy_name; char *dummy_name;
int t; int t;
@ -2674,7 +2674,7 @@ display_info_table (first, last)
int first; int first;
int last; int last;
{ {
extern bfd_target *bfd_target_vector[]; extern const bfd_target *const *bfd_target_vector;
int t, a; int t, a;
char *dummy_name; char *dummy_name;
@ -2743,7 +2743,7 @@ static void
display_target_tables () display_target_tables ()
{ {
int t, columns; int t, columns;
extern bfd_target *bfd_target_vector[]; extern const bfd_target *const *bfd_target_vector;
char *colum; char *colum;
columns = 0; columns = 0;

View File

@ -26,6 +26,7 @@ size \- list section sizes and total size.
.RB "[\|" \c .RB "[\|" \c
.BI "\-\-target=" bfdname\c .BI "\-\-target=" bfdname\c
\&\|] \&\|]
.RB "[\|" \-t "\|]"
.RB "[\|" \-V \||\| \-\-version "\|]" .RB "[\|" \-V \||\| \-\-version "\|]"
.I objfile\c .I objfile\c
\&.\|.\|. \&.\|.\|.
@ -125,6 +126,10 @@ automatically recognize many formats. See
for information for information
on listing available formats. on listing available formats.
.TP
.B \-t
Show totals of all objects listed (in Berkeley format listing mode only).
.TP .TP
.B \-V .B \-V
.TP .TP

View File

@ -48,6 +48,11 @@ int berkeley_format = BSD_DEFAULT; /* 0 means use AT&T-style output. */
int show_version = 0; int show_version = 0;
int show_help = 0; int show_help = 0;
int show_totals = 0;
static bfd_size_type total_bsssize;
static bfd_size_type total_datasize;
static bfd_size_type total_textsize;
/* Program exit status. */ /* Program exit status. */
int return_code = 0; int return_code = 0;
@ -60,9 +65,7 @@ static void display_file PARAMS ((char *filename));
static void display_bfd PARAMS ((bfd *)); static void display_bfd PARAMS ((bfd *));
static void display_archive PARAMS ((bfd *)); static void display_archive PARAMS ((bfd *));
static int size_number PARAMS ((bfd_size_type)); static int size_number PARAMS ((bfd_size_type));
#if 0
static void lprint_number PARAMS ((int, bfd_size_type)); static void lprint_number PARAMS ((int, bfd_size_type));
#endif
static void rprint_number PARAMS ((int, bfd_size_type)); static void rprint_number PARAMS ((int, bfd_size_type));
static void print_berkeley_format PARAMS ((bfd *)); static void print_berkeley_format PARAMS ((bfd *));
static void sysv_internal_sizer PARAMS ((bfd *, asection *, PTR)); static void sysv_internal_sizer PARAMS ((bfd *, asection *, PTR));
@ -77,7 +80,7 @@ usage (stream, status)
int status; int status;
{ {
fprintf (stream, _("\ fprintf (stream, _("\
Usage: %s [-ABdoxV] [--format=berkeley|sysv] [--radix=8|10|16]\n\ Usage: %s [-ABdotxV] [--format=berkeley|sysv] [--radix=8|10|16]\n\
[--target=bfdname] [--version] [--help] [file...]\n"), program_name); [--target=bfdname] [--version] [--help] [file...]\n"), program_name);
#if BSD_DEFAULT #if BSD_DEFAULT
fputs (_("default is --format=berkeley\n"), stream); fputs (_("default is --format=berkeley\n"), stream);
@ -120,7 +123,7 @@ main (argc, argv)
bfd_init (); bfd_init ();
set_default_bfd_target (); set_default_bfd_target ();
while ((c = getopt_long (argc, argv, "ABVdox", long_options, while ((c = getopt_long (argc, argv, "ABVdotwx", long_options,
(int *) 0)) != EOF) (int *) 0)) != EOF)
switch (c) switch (c)
{ {
@ -186,6 +189,10 @@ main (argc, argv)
case 'o': case 'o':
radix = octal; radix = octal;
break; break;
case 't':
show_totals = 1;
break;
case 'w':
case 0: case 0:
break; break;
case '?': case '?':
@ -203,6 +210,19 @@ main (argc, argv)
for (; optind < argc;) for (; optind < argc;)
display_file (argv[optind++]); display_file (argv[optind++]);
if (show_totals && berkeley_format) {
bfd_size_type total = total_textsize + total_datasize + total_bsssize;
lprint_number (7, total_textsize);
putchar('\t');
lprint_number (7, total_datasize);
putchar('\t');
lprint_number (7, total_bsssize);
printf (((radix == octal) ? "\t%-7lo\t%-7lx\t" : "\t%-7lu\t%-7lx\t"),
(unsigned long) total, (unsigned long) total);
fputs ("(TOTALS)\n", stdout);
}
return return_code; return return_code;
} }
@ -326,10 +346,6 @@ size_number (num)
return strlen (buffer); return strlen (buffer);
} }
#if 0
/* This is not used. */
static void static void
lprint_number (width, num) lprint_number (width, num)
int width; int width;
@ -344,8 +360,6 @@ lprint_number (width, num)
printf ("%-*s", width, buffer); printf ("%-*s", width, buffer);
} }
#endif
static void static void
rprint_number (width, num) rprint_number (width, num)
int width; int width;
@ -402,21 +416,27 @@ print_berkeley_format (abfd)
if (files_seen++ == 0) if (files_seen++ == 0)
#if 0 #if 0
/* Intel doesn't like bss/stk because they don't have core files. */ /* Intel doesn't like bss/stk because they don't have core files. */
puts ((radix == octal) ? " text\t data\tbss/stk\t oct\t hex\tfilename" : puts ((radix == octal) ? "text\tdata\tbss/stk\toct\thex\tfilename" :
" text\t data\tbss/stk\t dec\t hex\tfilename"); "text\tdata\tbss/stk\tdec\thex\tfilename");
#else #else
puts ((radix == octal) ? " text\t data\t bss\t oct\t hex\tfilename" : puts ((radix == octal) ? "text\tdata\tbss\toct\thex\tfilename" :
" text\t data\t bss\t dec\t hex\tfilename"); "text\tdata\tbss\tdec\thex\tfilename");
#endif #endif
total = textsize + datasize + bsssize; total = textsize + datasize + bsssize;
rprint_number (7, textsize); if (show_totals) {
putchar ('\t'); total_textsize += textsize;
rprint_number (7, datasize); total_datasize += datasize;
putchar ('\t'); total_bsssize += bsssize;
rprint_number (7, bsssize); }
printf (((radix == octal) ? "\t%7lo\t%7lx\t" : "\t%7lu\t%7lx\t"),
lprint_number (7, textsize);
putchar('\t');
lprint_number (7, datasize);
putchar('\t');
lprint_number (7, bsssize);
printf (((radix == octal) ? "\t%-7lo\t%-7lx\t" : "\t%-7lu\t%-7lx\t"),
(unsigned long) total, (unsigned long) total); (unsigned long) total, (unsigned long) total);
fputs (bfd_get_filename (abfd), stdout); fputs (bfd_get_filename (abfd), stdout);

View File

@ -26,7 +26,7 @@ strip \- Discard symbols from object files.
.RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals "\|]" .RB "[\|" \-X\fR\ |\ \fB\-\-discard\-locals "\|]"
.RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]" .RB "[\|" \-K\ \fIsymbolname\fR\ |\ \fB\-\-keep\-symbol=\fIsymbolname\fR "\|]"
.RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]" .RB "[\|" \-N\ \fIsymbolname\fR\ |\ \fB\-\-strip\-symbol=\fIsymbolname\fR "\|]"
.RB "[\|" \-o\ \fIfile\f\R "\|]" .RB "[\|" \-o\ \fIfile\fR "\|]"
.RB "[\|" \-p\fR\ |\ \fB\-\-preserve\-dates "\|]" .RB "[\|" \-p\fR\ |\ \fB\-\-preserve\-dates "\|]"
.RB "[\|" \-v\fR\ |\ \fB\-\-verbose "\|]" .RB "[\|" \-v\fR\ |\ \fB\-\-verbose "\|]"
.RB "[\|" \-V\fR\ |\ \fB\-\-version "\|]" .RB "[\|" \-V\fR\ |\ \fB\-\-version "\|]"