public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H . J . Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Subject: PATCH: Add -S/--print-size to nm
Date: Sat, 15 Jun 2002 10:35:00 -0000	[thread overview]
Message-ID: <20020615103503.A2070@lucon.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 64 bytes --]

I'd like to check in this patch to fix nm. Any comments?


H.J.

[-- Attachment #2: nm-size.patch --]
[-- Type: text/plain, Size: 3672 bytes --]

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/doc/binutils.texi.size	Fri Mar  8 09:48:13 2002
+++ binutils/doc/binutils.texi	Sat Jun 15 10:25:42 2002
@@ -659,7 +659,8 @@ The @sc{gnu} linker @command{ld} is now 
 @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
--- binutils/nm.c.size	Fri Jun 14 09:58:44 2002
+++ binutils/nm.c	Sat Jun 15 10:32:40 2002
@@ -161,6 +161,7 @@ static int defined_only = 0;	/* Print de
 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));

             reply	other threads:[~2002-06-15 17:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-15 10:35 H . J . Lu [this message]
2002-06-15 11:06 ` Nick Clifton
2002-06-15 11:38   ` H . J . Lu
2002-06-17  7:52 ` Elias Athanasopoulos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020615103503.A2070@lucon.org \
    --to=hjl@lucon.org \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).