public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Matt Austern <austern@apple.com>
To: gcc@gcc.gnu.org
Subject: 3.1/3.2 C++ ABI change
Date: Mon, 07 Oct 2002 16:11:00 -0000	[thread overview]
Message-ID: <D34692B2-DA38-11D6-AC60-00039390D9E0@apple.com> (raw)

Consider the following snippet:
      struct VBase {
        int n1;
        virtual ~VBase();
        virtual void f();
      };

      struct Derived : public virtual VBase {
        int n2;
        virtual ~Derived();
        virtual void g();
      };

      VBase::~VBase() { }
      Derived::~Derived() { }

With gcc 3.1, the beginning of Derived's vtable is:
_ZTV7Derived:
         .long   8
         .long   0
         .long   _ZTI7Derived
         .long   _ZN7Derived1gEv
         .long   _ZN7DerivedD1Ev
         .long   _ZN7DerivedD0Ev
         .long   0
         .long   -8
         .long   -8
         ...

With 3.2, on the other hand, these entries are:
_ZTV7Derived:
         .long   8
         .long   0
         .long   _ZTI7Derived
         .long   _ZN7DerivedD1Ev
         .long   _ZN7DerivedD0Ev
         .long   _ZN7Derived1gEv
         .long   0
         .long   -8
         .long   -8
         ...

My understanding is that this was an intentional change, because the
implementation of the ABI was incorrect in 3.1.  My understanding, in
fact, is that this was the whole point of the 3.2 release: there are 
very
few differences between 3.1 and 3.2 other than this ABI-breaking
change.  System vendors were encouraged to ship 3.2, which was
hoped to have a more stable C++ ABI.  Correct so far?

(If I'm wrong on the above, and if this vtable change is just a bug,
please correct me.)

The problem, of course, is that Apple shipped 3.1 as our system
compiler.  We're trying to figure out what to do next.  It looks like
there's some machinery in the compiler that lets users ask for
ABI compatibility with earlier compiler versions.  It also looks like
it's incomplete, and that it doesn't cover this particular vtable layout
change.

So,...
(1) Was it the intention behind the ABI compatibility switch that it
should cover this vtable change?
(2) If Apple provided code allowing C++ ABI compatibility with 3.1,
would people be interested?

			--Matt

             reply	other threads:[~2002-10-07 21:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-07 16:11 Matt Austern [this message]
2002-10-07 16:37 ` David Edelsohn
2002-10-08 11:57 ` Mark Mitchell

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=D34692B2-DA38-11D6-AC60-00039390D9E0@apple.com \
    --to=austern@apple.com \
    --cc=gcc@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).