PATCH: Fix demangler in symbol versioning
H. J. Lu
hjl@lucon.org
Thu Dec 4 23:53:00 GMT 2003
On Thu, Dec 04, 2003 at 06:11:32PM -0500, Ian Lance Taylor wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > > DMGL_TYPES tells the demangler to see if the string is the mangled
> > > version of a type encoding. I don't think the compiler will ever use
> > > a type encoding as an external symbol name--that doesn't even really
> > > make sense--so I don't think there is any need for DMGL_TYPES here.
> > >
> >
> > Will it lead to incorrect output? If not, I'd like to add it.
>
> It could conceivably lead to incorrect output. I don't know. For
> example, if you call cplus_demangle ("i", DMGL_TYPES), you will get
> "int". So if there is an external variable named `i', it seems
> conceivable that the wrong thing would happen. I haven't thought
> about whether this could really happen, though.
In that case, we have a regression with cxxfilt. The old one:
# cxxfilt i
i
The new one:
# ./cxxfilt i
int
Here is the new patch.
H.J.
----
2003-12-04 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (lang_vers_match): Updated calls to cplus_demangle.
--- ld/ldlang.c.dem 2003-12-04 11:36:55.000000000 -0800
+++ ld/ldlang.c 2003-12-04 15:19:19.000000000 -0800
@@ -4996,13 +4996,13 @@ lang_vers_match (struct bfd_elf_version_
if (head->mask & BFD_ELF_VERSION_CXX_TYPE)
{
- cxx_sym = cplus_demangle (sym, /* DMGL_NO_TPARAMS */ 0);
+ cxx_sym = cplus_demangle (sym, DMGL_PARAMS | DMGL_ANSI);
if (!cxx_sym)
cxx_sym = sym;
}
if (head->mask & BFD_ELF_VERSION_JAVA_TYPE)
{
- java_sym = cplus_demangle (sym, DMGL_JAVA);
+ java_sym = java_demangle_v3 (sym);
if (!java_sym)
java_sym = sym;
}
More information about the Gcc
mailing list