aboutsummaryrefslogtreecommitdiff
path: root/binutils/nm.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/nm.c')
-rw-r--r--binutils/nm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/binutils/nm.c b/binutils/nm.c
index 6d88748..d537441 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -161,6 +161,7 @@ static int show_stats = 0; /* Show statistics. */
static int show_synthetic = 0; /* Display synthesized symbols too. */
static int line_numbers = 0; /* Print line numbers for symbols. */
static int allow_special_symbols = 0; /* Allow special symbols. */
+static int with_symbol_versions = 0; /* Include symbol version information in the output. */
/* When to print the names of files. Not mutually exclusive in SYSV format. */
static int filename_per_file = 0; /* Once per file, on its own line. */
@@ -226,6 +227,7 @@ static struct option long_options[] =
{"defined-only", no_argument, &defined_only, 1},
{"undefined-only", no_argument, &undefined_only, 1},
{"version", no_argument, &show_version, 1},
+ {"with-symbol-versions", no_argument, &with_symbol_versions, 1},
{0, no_argument, 0, 0}
};
@@ -271,6 +273,7 @@ usage (FILE *stream, int status)
-t, --radix=RADIX Use RADIX for printing symbol values\n\
--target=BFDNAME Specify the target object format as BFDNAME\n\
-u, --undefined-only Display only undefined symbols\n\
+ --with-symbol-versions Display version strings after symbol names\n\
-X 32_64 (ignored)\n\
@FILE Read options from FILE\n\
-h, --help Display this information\n\
@@ -879,6 +882,21 @@ print_symbol (bfd * abfd,
format->print_symbol_info (&info, abfd);
+ if (with_symbol_versions)
+ {
+ const char * version_string = NULL;
+ bfd_boolean hidden = FALSE;
+
+ if ((sym->flags & BSF_SYNTHETIC) == 0)
+ version_string = bfd_get_symbol_version_string (abfd, sym, &hidden);
+
+ if (bfd_is_und_section (bfd_get_section (sym)))
+ hidden = TRUE;
+
+ if (version_string && *version_string != '\0')
+ printf (hidden ? "@%s" : "@@%s", version_string);
+ }
+
if (line_numbers)
{
static asymbol **syms;