This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

Re: [PATCH] New C++ abstraction patch


Andrew Cagney <ac131313@cygnus.com> writes:

> Daniel Berlin wrote:
> > 
> > Includes Elena's requested changes, moves gnu-v2-abi.c and gnu-v3-abi.c to
> > the root directory.
> 
> Dan,
> 
> If I understand things correctly, in C++, a function signature
> determines not just the calling convention but also the symbols real
> name.  If either of these requirements are not met then the code won't
> work. 

Yes.
It won't even link, though there's probably some pathological case i'm
missing where it will. If for some reason, it does link, it certainly
won't work.



> Consequently, for C++, the mangler and other C++ stuff really
> make up part of the over all application binary interface.

Yes.

Mangling is integral to any C++ ABI, because it is through mangling
that you get unique names for overloaded methods and class names,
and these unique names are the same, given the same function
signature, as required by the One Definition Rule (which C doesn't have).

The ODR, simplified, is as follow:

1. In any one translation unit, a template, type, function, or object
can have no more than one definition. (Some of these can have any number
of declarations. A definition provides an instance.)

2. In the entire program, an object or non-inline function cannot have
more than one definition; if an object or function is used, it must
have exactly one definition. (You can declare an object or function
that is never used, in which case you don't have to provide a
definition. In no event can there be more than one definition.)

3. Some things, like types, templates, and extern inline functions,
can be defined in more than one translation unit. For a given entity,
each definition must be the same. (Non-extern objects and functions
in different translation units are different entities, even if their
names and types are the same.)



(On a side note, this is why we can ignore duplicate C++ symbols just
based on the mangled name. Anytime we see another debug symbol,
anywhere, with the same name as something we've already seen, by the
ODR, it must be the exact same, and thus, have the exact same debug
info).
> 
> Hence the choice of ``cp-abi.*'' as the basename.

Yup.

> 
> 	Andrew


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