Consider the following code:
class base {
public:
base() = default;
virtual int foo() { return 0; }
};
class derived : public base {
public:
derived() = default;
virtual int foo() { return 1;}
};
Compiling this with Clang 3.3 I get the following output for the vtable:
__ZTV7derived:
.long 0 <--- what is this?
.long __ZTI7derived
.long __ZN7derived3fooEv
If I add the switch -fno-rtti
I get this:
__ZTV7derived:
.long 0 <--- what is this?
.long 0 <--- type info removed by -fno-rtti
.long __ZN7derived3fooEv
Which makes sense since the TypeInfo is now invalid, but what is the first .long 0
referring to? Also, why doesn't -fno-rtti
remove the type info altogether rather than just zero-ing it? I'm considering writing a pass to do this manually, but I'd like to know the implications of it first (I'm squeezing bytes out of an embedded platform)