aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--binutils/ChangeLog10
-rw-r--r--binutils/doc/binutils.texi7
-rw-r--r--binutils/nm.c10
3 files changed, 24 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index dce7568..26c052f 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 <eathan@otenet.gr>
* nm.c (struct extended_symbol_info): New strcuture: Add the size
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index 807f43e..2b91f8e 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 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));