From aa02037b08312eece5c06e1e98b2ce8b30993c5c Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 11 May 2022 13:54:30 +0100 Subject: nm: use -U as an alias for --defines-only, in line with llvm-nm --- binutils/nm.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'binutils/nm.c') 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")) -- cgit v1.1