diff options
author | Alan Modra <amodra@bigpond.net.au> | 2002-06-26 13:22:55 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2002-06-26 13:22:55 +0000 |
commit | 5aa4202af7d5b5f1ab44bc75bb2a19ba76cf7250 (patch) | |
tree | a0c1e2f80e8108572a89495965cd6a5f9c6e1c41 /ld/ldmisc.c | |
parent | 362ee94cc92d72b9164332e0acc458445003ff64 (diff) | |
download | binutils-redhat-5aa4202af7d5b5f1ab44bc75bb2a19ba76cf7250.tar.gz |
* ldmisc.c (demangle): Restore dots stripped from sym name.
Diffstat (limited to 'ld/ldmisc.c')
-rw-r--r-- | ld/ldmisc.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/ld/ldmisc.c b/ld/ldmisc.c index 42adceeac3..b24678e917 100644 --- a/ld/ldmisc.c +++ b/ld/ldmisc.c @@ -78,13 +78,31 @@ demangle (string) /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF or the MS PE format. These formats have a number of leading '.'s - on at least some symbols, so we remove all dots. */ + on at least some symbols, so we remove all dots to avoid + confusing the demangler. */ p = string; while (*p == '.') ++p; res = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS); - return res ? res : xstrdup (string); + if (res) + { + size_t dots = p - string; + + /* Now put back any stripped dots. */ + if (dots != 0) + { + size_t len = strlen (res) + 1; + char *add_dots = xmalloc (len + dots); + + memcpy (add_dots, string, dots); + memcpy (add_dots + dots, res, len); + free (res); + res = add_dots; + } + return res; + } + return xstrdup (string); } static void |