This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [java/c++/rfc] avoid plt references to cni methods


Andrew Haley <aph@redhat.com> 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>
    TF <type>
    TJ <type>
    GR <name>

The ABI permits the following there:

    TV <type>
    TT <type>
    TI <type>
    TS <type>
    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:
    'C'  constructor
    'D'  destructor
    'G'  special name
    'T'  special name
    'N'  nested name
    'S'  substitution
    '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>+

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]