This is the mail archive of the
mailing list for the GCC project.
Re: [java/c++/rfc] avoid plt references to cni methods
- From: Ian Lance Taylor <ian at airs dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: Richard Henderson <rth at redhat dot com>, java-patches at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: 25 May 2005 10:14:26 -0400
- Subject: Re: [java/c++/rfc] avoid plt references to cni methods
- References: <20050524211342.GA22147@redhat.com><email@example.com>
Andrew Haley <firstname.lastname@example.org> writes:
> > On the C++ side, I need to wait until we've resolved clones. Since
> > this is done during cgraph_analyze_function, which makes it difficult
> > to do this except for a separate pass over the generated functions.
> > I've somewhat arbitrarily chosen to extend the mangling grammar:
> > <special_name> := HA <encoding>
> > where "HA" stands for "hidden alias". It's not inconcievable that
> > such aliases could be useful in other cases. In any event, it seemed
> > safer to inject myself into a logical point in the grammar like this
> > than invent my own private prefix/suffix which could just as easily
> > conflict with other symbols.
> I guess that's OK, but it seems a little arbitrary. I wonder if there
> ought to be some well-defined langauge-specific way to do special
> mangling: we're going to need to extend it again for Java methods that
> only differe by return type.
The mangling ABI unfortunately does not provide an extension which
permits modifying a complete encoding. That said, there is already a
history of using two characters after the _Z to do extension
encodings. g++ currently uses the following extensions to the ABI:
TC <type> <(offset) number> _ <(base) type>
The ABI permits the following there:
GV <(object) name>
T <call-offset> <(base) encoding>
Tc <call-offset> <call-offset> <(base) encoding>
(<call-offset> always start with 'h' or 'v').
So using HA is arbitrary but not really more arbitrary than existing
code. Except actually it might be a bit cleaner if it started with
'G' or 'T' rather than 'H'. Currently the following are taken:
'G' special name
'T' special name
'N' nested name
'Z' local name
Also all lower case letters are taken for operator names and all
digits are taken for source names.
A similar approach will work for mangling names that differ by return
type. The return type is always recorded for a function type except
for a non-template function at the top level. So it would seem
more or less reasonable to use
GJ <(function) name> <return-type> <type>+