This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Objective-C name (de)mangling
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: kaih at khms dot westfalen dot de (Kai Henningsen)
- Cc: gcc at gcc dot gnu dot org
- Date: 05 Jan 2004 15:02:18 -0500
- Subject: Re: Objective-C name (de)mangling
- References: <90JD0fLHw-B@khms.westfalen.de>
kaih@khms.westfalen.de (Kai Henningsen) writes:
> I believe the demanglers currently handle C++ and (at least one of them)
> Java, but not Objective-C. (Correct?)
Correct.
> Objective-C name mangling is fairly simple - perhaps too simple: it is not
> always reversible in the face of original identifiers with underscores.
A mangling which is not reversible is probably ambiguous. It looks to
me as though if you carefully shift underscores from the start to the
end of selector names (e.g., foo_:bar to foo:_bar), you can get the
same mangled name for different methods.
But then I don't know Objective C at all.
If you want to add demangling support, write the demangler and put it
in libiberty, probably in a new source file, add a new style to
include/demangle.h (e.g., DMGL_OBJC), modify cplus_demangle() in
libiberty/cplus-dem.c to detect the style and call your new demangler,
and add your new style to libiberty_demanglers[] in
libiberty/cplus-dem.c.
After that, c++filt and the binutils programs should more or less just
work--that is, you should be able to use something like
--demangle=objc to demangle Objective C names.
Ian