public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 3.1/3.2 C++ ABI change
@ 2002-10-07 16:11 Matt Austern
  2002-10-07 16:37 ` David Edelsohn
  2002-10-08 11:57 ` Mark Mitchell
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Austern @ 2002-10-07 16:11 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-08 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-07 16:11 3.1/3.2 C++ ABI change Matt Austern
2002-10-07 16:37 ` David Edelsohn
2002-10-08 11:57 ` Mark Mitchell

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).