aboutsummaryrefslogtreecommitdiff
path: root/binutils/nm.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2022-05-11 13:54:30 +0100
committerNick Clifton <nickc@redhat.com>2022-05-11 13:54:30 +0100
commitaa02037b08312eece5c06e1e98b2ce8b30993c5c (patch)
treed160e8042aba2e444106cb73dd251e2b481135df /binutils/nm.c
parentb00d6678f6ef55ef52d79bfd5424d775bba01f0e (diff)
downloadfsf-binutils-gdb-aa02037b08312eece5c06e1e98b2ce8b30993c5c.zip
fsf-binutils-gdb-aa02037b08312eece5c06e1e98b2ce8b30993c5c.tar.gz
fsf-binutils-gdb-aa02037b08312eece5c06e1e98b2ce8b30993c5c.tar.bz2
nm: use -U as an alias for --defines-only, in line with llvm-nm
Diffstat (limited to 'binutils/nm.c')
-rw-r--r--binutils/nm.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/binutils/nm.c b/binutils/nm.c
index c8ea75f..9edaa8d 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -242,6 +242,7 @@ enum long_option_values
OPTION_RECURSE_LIMIT,
OPTION_NO_RECURSE_LIMIT,
OPTION_IFUNC_CHARS,
+ OPTION_UNICODE,
OPTION_QUIET
};
@@ -276,9 +277,9 @@ static struct option long_options[] =
{"special-syms", no_argument, &allow_special_symbols, 1},
{"synthetic", no_argument, &show_synthetic, 1},
{"target", required_argument, 0, OPTION_TARGET},
- {"defined-only", no_argument, &defined_only, 1},
- {"undefined-only", no_argument, &undefined_only, 1},
- {"unicode", required_argument, NULL, 'U'},
+ {"defined-only", no_argument, 0, 'U'},
+ {"undefined-only", no_argument, 0, 'u'},
+ {"unicode", required_argument, NULL, OPTION_UNICODE},
{"version", no_argument, &show_version, 1},
{"with-symbol-versions", no_argument, &with_symbol_versions, 1},
{"without-symbol-versions", no_argument, &with_symbol_versions, 0},
@@ -312,8 +313,6 @@ usage (FILE *stream, int status)
fprintf (stream, _("\
-D, --dynamic Display dynamic symbols instead of normal symbols\n"));
fprintf (stream, _("\
- --defined-only Display only defined symbols\n"));
- fprintf (stream, _("\
-e (ignored)\n"));
fprintf (stream, _("\
-f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',\n\
@@ -361,8 +360,10 @@ usage (FILE *stream, int status)
fprintf (stream, _("\
-u, --undefined-only Display only undefined symbols\n"));
fprintf (stream, _("\
- -U {d|s|i|x|e|h} Specify how to treat UTF-8 encoded unicode characters\n\
- --unicode={default|show|invalid|hex|escape|highlight}\n"));
+ -U, --defined-only Display only defined symbols\n"));
+ fprintf (stream, _("\
+ --unicode={default|show|invalid|hex|escape|highlight}\n\
+ Specify how to treat UTF-8 encoded unicode characters\n"));
fprintf (stream, _("\
--with-symbol-versions Display version strings after symbol names\n"));
fprintf (stream, _("\
@@ -2143,9 +2144,14 @@ main (int argc, char **argv)
break;
case 'u':
undefined_only = 1;
+ defined_only = 0;
break;
-
case 'U':
+ defined_only = 1;
+ undefined_only = 0;
+ break;
+
+ case OPTION_UNICODE:
if (streq (optarg, "default") || streq (optarg, "d"))
unicode_display = unicode_default;
else if (streq (optarg, "locale") || streq (optarg, "l"))