Mangling: Special names
Jim Dehnert
dehnert at baalbek.engr.sgi.com
Sat Mar 25 07:20:54 UTC 2000
> Date: Wed, 22 Mar 2000 15:46:59 +0100
> From: Martin von Loewis <loewis at informatik.hu-berlin.de>
>
> According to the mangling syntax,
>
> Foo::Foo(int)
>
> would be mangled as
>
> _ZN3FooC1Ei
>
> i.e. the constructor <special-name> would syntactically fit only after
> a qualified name. Is this intentional?
Good question. I interpreted C1/C2/C3/C4 as being the default
constructors, with the following derivation for Foo::Foo(), which is
the constructor for type Foo:
<encoding> -> _Z <name> <type>
-> _Z <special-name> <class-enum-type>
-> _Z C1 <source-name>
-> _Z C1 3Foo
Your example, no longer the default constructor, becomes:
_ZN3Foo3FooEi
Is that what you intended, Daveed?
> Likewise, _ZN3Foo3BarTVE would be the Foo::Bar virtual table.
No, it goes:
<encoding> -> _Z <name> <type>
-> _Z <special-name> <class-enum-type>
-> _Z TV <nested-name>
-> _Z TV N 3Foo 3Bar E
> I don't understand the Th and Tv special names: Instead of a
> function-type, would you not need an <name> somewhere? Or even an
> <encoding>?
There is one. Suppose we have A::foo(), and then derive B from A
with a B::foo() overriding. Then B::foo() is
_ZN1B3fooE
which serves as the base in the derivation for the override thunk from
A. The non-virtual one, assuming the A->B adjustment is -36, is:
Thn36_ <base name> <base function-type>
Thn36_ N1B3fooE FE
The virtual one (i.e. A is a virtual base), assuming the vptr
displacement of the vcall offset is -12, is:
Tv12 <base name> <base function-type> <base class type>
Tv12 N1B3fooE FE 1A
So in both cases, <base name> <base function-type> is essentially an
encoding, but the type is delimited (because it needs to be to separate
it from the base class type in the virtual case, though I guess it
could be eliminated in the non-virtual case).
Any other interpretations out there? Must be...
Jim
- Jim Dehnert dehnert at sgi.com
(650)933-4272
More information about the cxx-abi-dev
mailing list