diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-16 17:56:50 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-16 17:56:50 +0000 |
commit | 6400c038e5357d0f781fc0b602282f8e14dbb131 (patch) | |
tree | 9d3533fc1dff04194be510a494ce250339df5c37 /libiberty/cp-demangle.c | |
parent | 1fea6e9c7233dd498c318e24eda247ba8c931519 (diff) | |
download | gcc-6400c038e5357d0f781fc0b602282f8e14dbb131.tar.gz |
Properly demangle a global constructor symbol.
2010-11-16 H.J. Lu <hongjiu.lu@intel.com>
PR other/42670
PR binutils/11137
* cp-demangle.c (d_make_demangle_mangled_name): New.
(d_demangle_callback): Use it on DCT_GLOBAL_XTORS.
* testsuite/demangle-expected: Updated.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166810 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/cp-demangle.c')
-rw-r--r-- | libiberty/cp-demangle.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 8b0b825099e..7e951cc7842 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -322,6 +322,9 @@ static struct demangle_component * d_make_name (struct d_info *, const char *, int); static struct demangle_component * +d_make_demangle_mangled_name (struct d_info *, const char *); + +static struct demangle_component * d_make_builtin_type (struct d_info *, const struct demangle_builtin_type_info *); @@ -869,6 +872,17 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, return p; } +/* Add a new demangle mangled name component. */ + +static struct demangle_component * +d_make_demangle_mangled_name (struct d_info *di, const char *s) +{ + if (d_peek_char (di) != '_' || d_peek_next_char (di) != 'Z') + return d_make_name (di, s, strlen (s)); + d_advance (di, 2); + return d_encoding (di, 0); +} + /* Add a new name component. */ static struct demangle_component * @@ -4823,7 +4837,7 @@ d_demangle_callback (const char *mangled, int options, (type == DCT_GLOBAL_CTORS ? DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS : DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS), - d_make_name (&di, d_str (&di), strlen (d_str (&di))), + d_make_demangle_mangled_name (&di, d_str (&di)), NULL); d_advance (&di, strlen (d_str (&di))); break; |