From 72797995ca94ab07c55b11c4f036305250d7378c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 15 Jun 2002 18:40:26 +0000 Subject: [PATCH] 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. --- binutils/ChangeLog | 10 ++++++++++ binutils/doc/binutils.texi | 7 ++++++- binutils/nm.c | 10 ++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index dce7568180c..26c052f2a3b 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,13 @@ +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. + 2002-6-13 Elias Athanasopoulos * nm.c (struct extended_symbol_info): New strcuture: Add the size diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 807f43efcb5..2b91f8ee3ab 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -659,7 +659,8 @@ The @sc{gnu} linker @command{ld} is now described in a separate manual. @c man begin SYNOPSIS nm nm [@option{-a}|@option{--debug-syms}] [@option{-g}|@option{--extern-only}] [@option{-B}] [@option{-C}|@option{--demangle}[=@var{style}]] [@option{-D}|@option{--dynamic}] - [@option{-s}|@option{--print-armap}] [@option{-A}|@option{-o}|@option{--print-file-name}] + [@option{-S}|@option{--print-size}] [@option{-s}|@option{--print-armap}] + [@option{-A}|@option{-o}|@option{--print-file-name}] [@option{-n}|@option{-v}|@option{--numeric-sort}] [@option{-p}|@option{--no-sort}] [@option{-r}|@option{--reverse-sort}] [@option{--size-sort}] [@option{-u}|@option{--undefined-only}] [@option{-t} @var{radix}|@option{--radix=}@var{radix}] [@option{-P}|@option{--portability}] @@ -851,6 +852,10 @@ encountered. Use the POSIX.2 standard output format instead of the default format. Equivalent to @samp{-f posix}. +@item -S +@itemx --print-size +Print size of defined symbols for the @code{bsd} output format. + @item -s @itemx --print-armap @cindex symbol index, listing diff --git a/binutils/nm.c b/binutils/nm.c index bdb9ceeaafb..7b55440675f 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)); -- 2.30.2