This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
nm sort options
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 16 Jan 2012 19:13:34 +1030
- Subject: nm sort options
nm --no-sort, --numeric-sort and --size-sort are obviously mutually
exclusive, so make them so.
PR binutils/13593
* nm.c (OPTION_SIZE_SORT): Define.
(long_options): Don't set no_sort, sort_numerically or
sort_by_size directly.
(main): Instead set the flags here, making them mutually exclusive.
Index: binutils/nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.68
diff -u -p -r1.68 nm.c
--- binutils/nm.c 12 Jul 2011 04:47:49 -0000 1.68
+++ binutils/nm.c 16 Jan 2012 08:34:31 -0000
@@ -184,7 +184,8 @@ static bfd *lineno_cache_bfd;
static bfd *lineno_cache_rel_bfd;
#define OPTION_TARGET 200
-#define OPTION_PLUGIN 201
+#define OPTION_PLUGIN (OPTION_TARGET + 1)
+#define OPTION_SIZE_SORT (OPTION_PLUGIN + 1)
static struct option long_options[] =
{
@@ -197,8 +198,8 @@ static struct option long_options[] =
{"line-numbers", no_argument, 0, 'l'},
{"no-cplus", no_argument, &do_demangle, 0}, /* Linux compatibility. */
{"no-demangle", no_argument, &do_demangle, 0},
- {"no-sort", no_argument, &no_sort, 1},
- {"numeric-sort", no_argument, &sort_numerically, 1},
+ {"no-sort", no_argument, 0, 'p'},
+ {"numeric-sort", no_argument, 0, 'n'},
{"plugin", required_argument, 0, OPTION_PLUGIN},
{"portability", no_argument, 0, 'P'},
{"print-armap", no_argument, &print_armap, 1},
@@ -206,7 +207,7 @@ static struct option long_options[] =
{"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},
+ {"size-sort", no_argument, 0, OPTION_SIZE_SORT},
{"special-syms", no_argument, &allow_special_symbols, 1},
{"stats", no_argument, &show_stats, 1},
{"synthetic", no_argument, &show_synthetic, 1},
@@ -1593,10 +1594,19 @@ main (int argc, char **argv)
break;
case 'n':
case 'v':
+ no_sort = 0;
sort_numerically = 1;
+ sort_by_size = 0;
break;
case 'p':
no_sort = 1;
+ sort_numerically = 0;
+ sort_by_size = 0;
+ break;
+ case OPTION_SIZE_SORT:
+ no_sort = 0;
+ sort_numerically = 0;
+ sort_by_size = 1;
break;
case 'P':
set_output_format ("posix");
--
Alan Modra
Australia Development Lab, IBM