diff options
Diffstat (limited to 'binutils/nm.c')
-rw-r--r-- | binutils/nm.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/binutils/nm.c b/binutils/nm.c index 2946bd6..e77828e 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -407,21 +407,17 @@ static void print_symname (const char *form, struct extended_symbol_info *info, const char *name, bfd *abfd) { + char *alloc = NULL; + if (name == NULL) name = info->sinfo->name; if (do_demangle && *name) { - char *res = bfd_demangle (abfd, name, demangle_flags); - - if (res != NULL) - { - printf (form, res); - free (res); - return; - } + alloc = bfd_demangle (abfd, name, demangle_flags); + if (alloc != NULL) + name = alloc; } - printf (form, name); if (info != NULL && info->elfinfo) { const char *version_string; @@ -431,11 +427,17 @@ print_symname (const char *form, struct extended_symbol_info *info, = bfd_get_symbol_version_string (abfd, &info->elfinfo->symbol, FALSE, &hidden); if (version_string && version_string[0]) - printf ("%s%s", - (hidden || bfd_is_und_section (info->elfinfo->symbol.section) - ? "@" : "@@"), - version_string); + { + const char *at = "@@"; + if (hidden || bfd_is_und_section (info->elfinfo->symbol.section)) + at = "@"; + alloc = reconcat (alloc, name, at, version_string, NULL); + if (alloc != NULL) + name = alloc; + } } + printf (form, name); + free (alloc); } static void |