aboutsummaryrefslogtreecommitdiff
path: root/binutils/nm.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2002-06-15 18:40:26 +0000
committerH.J. Lu <hjl.tools@gmail.com>2002-06-15 18:40:26 +0000
commit72797995ca94ab07c55b11c4f036305250d7378c (patch)
tree95740ecce5f484f5cc587d26cf19f9986f1bfd1e /binutils/nm.c
parent22ba8cf20bdded9665a5d233d1c1428e7b846e92 (diff)
downloadgdb-72797995ca94ab07c55b11c4f036305250d7378c.zip
gdb-72797995ca94ab07c55b11c4f036305250d7378c.tar.gz
gdb-72797995ca94ab07c55b11c4f036305250d7378c.tar.bz2
2002-06-15 H.J. Lu (hjl@gnu.org)
* nm.c (print_size): New variable. Initialize to 0. (long_options): Add 'S'/"print-size". (main): Handle 'S'. (print_symbol_info_bsd): Print size only if print_size is not 0. * doc/binutils.texi: Document -S/--print-size.
Diffstat (limited to 'binutils/nm.c')
-rw-r--r--binutils/nm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/binutils/nm.c b/binutils/nm.c
index bdb9cee..7b55440 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -161,6 +161,7 @@ static int defined_only = 0; /* Print defined symbols only. */
static int no_sort = 0; /* Don't sort; print syms in order found. */
static int print_debug_syms = 0;/* Print debugger-only symbols too. */
static int print_armap = 0; /* Describe __.SYMDEF data in archive files. */
+static int print_size = 0; /* Print size of defined symbols. */
static int reverse_sort = 0; /* Sort in downward(alpha or numeric) order. */
static int sort_numerically = 0;/* Sort in numeric rather than alpha order. */
static int sort_by_size = 0; /* Sort by size of symbol. */
@@ -218,6 +219,7 @@ static struct option long_options[] =
{"portability", no_argument, 0, 'P'},
{"print-armap", no_argument, &print_armap, 1},
{"print-file-name", no_argument, 0, 'o'},
+ {"print-size", no_argument, 0, 'S'},
{"radix", required_argument, 0, 't'},
{"reverse-sort", no_argument, &reverse_sort, 1},
{"size-sort", no_argument, &sort_by_size, 1},
@@ -259,6 +261,7 @@ usage (stream, status)
-p, --no-sort Do not sort the symbols\n\
-P, --portability Same as --format=posix\n\
-r, --reverse-sort Reverse the sense of the sort\n\
+ -S, --print-size Print size of defined symbols\n\
-s, --print-armap Include index for symbols from archive members\n\
--size-sort Sort symbols by size\n\
-t, --radix=RADIX Use RADIX for printing symbol values\n\
@@ -360,7 +363,7 @@ main (argc, argv)
bfd_init ();
set_default_bfd_target ();
- while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrst:uvVvX:",
+ while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uvVvX:",
long_options, (int *) 0)) != EOF)
{
switch (c)
@@ -423,6 +426,9 @@ main (argc, argv)
case 's':
print_armap = 1;
break;
+ case 'S':
+ print_size = 1;
+ break;
case 't':
set_print_radix (optarg);
break;
@@ -1454,7 +1460,7 @@ print_symbol_info_bsd (info, abfd)
{
print_value (abfd, SYM_VALUE (info));
- if (SYM_SIZE (info))
+ if (print_size && SYM_SIZE (info))
{
printf(" ");
print_value (abfd, SYM_SIZE (info));