Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Berlin <dberlin@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] New C++ abstraction patch
Date: Wed, 21 Feb 2001 13:31:00 -0000	[thread overview]
Message-ID: <x7d7cbvi3e.fsf@dynamic-addr-83-177.resnet.rochester.edu> (raw)
In-Reply-To: <3A940ED9.317F856@cygnus.com>

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


  reply	other threads:[~2001-02-21 13:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-20 16:02 Daniel Berlin
2001-02-21  1:53 ` Eli Zaretskii
2001-02-21 10:56 ` Andrew Cagney
2001-02-21 13:31   ` Daniel Berlin [this message]
2001-02-20 17:35 Michael Elizabeth Chastain
2001-02-20 19:42 ` Daniel Berlin
2001-02-21 10:42   ` Andrew Cagney
2001-02-21 13:03     ` Daniel Berlin
2001-02-21 13:25       ` Andrew Cagney
2001-02-21 15:19         ` Michael Snyder
2001-02-22  8:14           ` Andrew Cagney
2001-02-20 20:42 Michael Elizabeth Chastain
2001-02-20 23:42 ` Daniel Berlin
2001-02-21 11:53   ` Michael Snyder
2001-02-21 14:24     ` J.T. Conklin
2001-02-21 15:21       ` Michael Snyder
2001-02-21  7:43 Michael Elizabeth Chastain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x7d7cbvi3e.fsf@dynamic-addr-83-177.resnet.rochester.edu \
    --to=dberlin@redhat.com \
    --cc=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox