RTTI inconsistency

Nathan Sidwell sidwell at codesourcery.com
Thu Jan 6 12:52:49 UTC 2000


Hi,
there is an inconsistency in the documentation of how a vtable
points to the type_info object for that type.

The abi layout document Run-Time Type Information (RTTI) section states,

3.Every vtable shall contain one entry pointing to an object derived
	from std::type_info. This entry is located at the word preceding
	the location pointed to by the vptr (i.e., entry "-1"). The
	entry is allocated in all vtables; for classes having virtual bases
	but no virtual functions, the entry is zero. This entry is coded
	as an offset with respect to the virtual table origin, rather than as
	a pointer (thereby avoiding run-time relocations). 

but the closed issues document section A-6 ends by saying
	[991028 all] The current definition, in the ABI data layout document,
	has been updated with Daveed's changes, and is accepted. Note that we
	are back to using a pointer to RTTI in the vtable (see B-8), since we
	need uniqueness, and since we need an external symbol in any case, the
	ABI will make no statement about where RTTI is allocated. It is likely
	that implementations will use COMDAT for it. 

Also the Virtual Table Layout section of the ABI document says,
	The typeinfo pointer points to the typeinfo object used for RTTI.
	All entries in each of the vtables for a given class must point to the
	same typeinfo object. A correct implementation of typeinfo equality is
	to check pointer equality. 

so which is it? An offset or a pointer? (I think it has to be a pointer to
get uniqueness.)

nathan

-- 
Dr Nathan Sidwell :: sidwell at codesourcery.com
nathan at acm.org  http://www.cs.bris.ac.uk/~nathan/




More information about the cxx-abi-dev mailing list