Index: objcopy.c =================================================================== RCS file: /cvs/src/src/binutils/objcopy.c,v retrieving revision 1.34 diff -c -r1.34 objcopy.c *** objcopy.c 2002/01/15 17:18:53 1.34 --- objcopy.c 2002/01/20 23:49:47 *************** *** 438,444 **** -p --preserve-dates Copy modified/access timestamps to the output\n\ -R --remove-section Remove section from the output\n\ -s --strip-all Remove all symbol and relocation information\n\ ! -g -S --strip-debug Remove all debugging symbols\n\ --strip-unneeded Remove all symbols not needed by relocations\n\ -N --strip-symbol Do not copy symbol \n\ -K --keep-symbol Only copy symbol \n\ --- 438,444 ---- -p --preserve-dates Copy modified/access timestamps to the output\n\ -R --remove-section Remove section from the output\n\ -s --strip-all Remove all symbol and relocation information\n\ ! -g -S -d --strip-debug Remove all debugging symbols\n\ --strip-unneeded Remove all symbols not needed by relocations\n\ -N --strip-symbol Do not copy symbol \n\ -K --keep-symbol Only copy symbol \n\ Index: size.c =================================================================== RCS file: /cvs/src/src/binutils/size.c,v retrieving revision 1.9 diff -c -r1.9 size.c *** size.c 2001/12/18 08:22:30 1.9 --- size.c 2002/01/20 23:49:47 *************** *** 1,6 **** /* size.c -- report size of various sections of an executable file. ! Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 ! Free Software Foundation, Inc. This file is part of GNU Binutils. --- 1,6 ---- /* size.c -- report size of various sections of an executable file. ! Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, ! 2002 Free Software Foundation, Inc. This file is part of GNU Binutils. *************** *** 48,53 **** --- 48,58 ---- int show_version = 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. */ int return_code = 0; *************** *** 79,85 **** fprintf (stream, _("\ Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n\ [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n\ ! [-V | --version] [--target=bfdname] [--help] [file...]\n"), program_name); #if BSD_DEFAULT fputs (_("default is --format=berkeley\n"), stream); --- 84,91 ---- fprintf (stream, _("\ Usage: %s [-A | --format=sysv | -B | --format=berkeley]\n\ [-o | --radix=8 | -d | --radix=10 | -h | --radix=16]\n\ ! [-V | --version] [--target=bfdname] [--help] \n\ ! [--totals | -t] [file...]\n"), program_name); #if BSD_DEFAULT fputs (_("default is --format=berkeley\n"), stream); *************** *** 99,104 **** --- 105,111 ---- {"target", required_argument, 0, 202}, {"version", no_argument, &show_version, 1}, {"help", no_argument, &show_help, 1}, + {"totals", no_argument, &show_totals, 1}, {0, no_argument, 0, 0} }; *************** *** 127,133 **** bfd_init (); set_default_bfd_target (); ! while ((c = getopt_long (argc, argv, "ABVdfox", long_options, (int *) 0)) != EOF) switch (c) { --- 134,140 ---- bfd_init (); set_default_bfd_target (); ! while ((c = getopt_long (argc, argv, "ABVdfotx", long_options, (int *) 0)) != EOF) switch (c) { *************** *** 193,198 **** --- 200,208 ---- case 'o': radix = octal; break; + case 't': + show_totals = 1; + break; case 'f': /* FIXME : For sysv68, `-f' means `full format', i.e. `[fname:] M(.text) + N(.data) + O(.bss) + P(.comment) = Q' where `fname: ' appears only if there are >= 2 input files, *************** *** 220,225 **** --- 230,249 ---- for (; optind < argc;) display_file (argv[optind++]); + if (show_totals && berkeley_format) + { + bfd_size_type total = total_textsize + total_datasize + total_bsssize; + + rprint_number (7, total_textsize); + putchar('\t'); + rprint_number (7, total_datasize); + putchar('\t'); + rprint_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; } *************** *** 427,432 **** --- 451,463 ---- #endif total = textsize + datasize + bsssize; + + if (show_totals) + { + total_textsize += textsize; + total_datasize += datasize; + total_bsssize += bsssize; + } rprint_number (7, textsize); putchar ('\t'); Index: doc/binutils.texi =================================================================== RCS file: /cvs/src/src/binutils/doc/binutils.texi,v retrieving revision 1.14 diff -c -r1.14 binutils.texi *** binutils.texi 2002/01/15 17:18:53 1.14 --- binutils.texi 2002/01/20 23:49:56 *************** *** 1758,1763 **** --- 1758,1764 ---- @c man begin SYNOPSIS size size [@option{-A}|@option{-B}|@option{--format=}@var{compatibility}] [@option{--help}] [@option{-d}|@option{-o}|@option{-x}|@option{--radix=}@var{number}] + [@option{-t}|@option{--totals}] [@option{--target=}@var{bfdname}] [@option{-V}|@option{--version}] [@var{objfile}@dots{}] @c man end *************** *** 1840,1845 **** --- 1841,1850 ---- radices; decimal and hexadecimal for @option{-d} or @option{-x} output, or octal and hexadecimal if you're using @option{-o}. + @item -t + @itemx --totals + Show totals of all objects listed (Berkeley format listing mode only). + @item --target=@var{bfdname} @cindex object code format Specify that the object-code format for @var{objfile} is *************** *** 1971,1977 **** strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname} ] [@option{-I} @var{bfdname} |@option{--input-target=}@var{bfdname} ] [@option{-O} @var{bfdname} |@option{--output-target=}@var{bfdname} ] ! [@option{-s}|@option{--strip-all}] [@option{-S}|@option{-g}|@option{--strip-debug}] [@option{-K} @var{symbolname} |@option{--keep-symbol=}@var{symbolname} ] [@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname} ] [@option{-x}|@option{--discard-all} ] [@option{-X} |@option{--discard-locals}] --- 1976,1982 ---- strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname} ] [@option{-I} @var{bfdname} |@option{--input-target=}@var{bfdname} ] [@option{-O} @var{bfdname} |@option{--output-target=}@var{bfdname} ] ! [@option{-s}|@option{--strip-all}] [@option{-S}|@option{-g}|@option{-d}|@option{--strip-debug}] [@option{-K} @var{symbolname} |@option{--keep-symbol=}@var{symbolname} ] [@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname} ] [@option{-x}|@option{--discard-all} ] [@option{-X} |@option{--discard-locals}] *************** *** 2028,2033 **** --- 2033,2039 ---- @item -g @itemx -S + @itemx -d @itemx --strip-debug Remove debugging symbols only.