This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ name mangling, old and new versions?
On Thu, Mar 05, 1998 at 05:24:29AM +0100, Jason Merrill wrote:
> >>>>> ak <ak@muc.de> writes:
>
> > On Thu, Mar 05, 1998 at 04:37:33AM +0100, Jason Merrill wrote:
> >> >>>>> Andi Kleen <ak@muc.de> writes:
> >>
> >> > I had good look with -fno-rtti -fno-exceptions together with a 2.7.2
> >> > compiled Qt. The vtable layout is different when RTTI is enabled, so
> >> > egcs protects against mistakes by encoding that in the mangled name.
> >>
> >> Both those statements are false for -fno-rtti, though they are true of
> >> -fvtable-thunks.
>
> > You mean the mangling is only changed (between -frtti/no-rtti) when
> > vtable-thunks is enabled? If this is true how is the typeinfo encoded
> > then when vtable-thunks is not enabled?
>
> No. -frtti has no effect on vtable layout or mangling, ever.
> -fvtable-thunks changes vtable layout and mangling.
>
> If -fno-rtti, the RTTI entry in the vtable is set to zero, but the layout
> is the same.
I see. I didn't know that 2.7.2 already had a reserved vtable entry for
the rtti function(1), therefore the confusion. The original point still holds -
a 2.7.2 compiled shared library Qt doesn't link with a egcs program (even
though Qt doesn't use RTTI) unless -fno-exceptions -fno-rtti is specified.
It complains about missing "Class type_info function" (that is probably the
RTTI entry you were refering to), and missing RTTI (__rtti_class) and
exceptions function from the runtime library. I don't know why -fno-rtti/
-fno-exceptions makes a difference for the runtime library.
-Andi
(1) Thanks to rth for the pointer.