[cxx-abi-dev] ABI limitation on the size of a class

Nathan Sidwell nathan at codesourcery.com
Wed Feb 23 16:44:03 UTC 2005


Christian BRUEL wrote:
> 
> I'm trying to understand the rational for the 1.2 Limit section in the 
> itanium C++ ABI (http://www.codesourcery.com/cxx-abi/abi.html#limits)
> 
> The section says that this limitation is due to RTTI implementation. Is 
> it because of the field to the beginning of the complete type in the 
> typeinfos ?
> in the libstdc++ sources (gcc 3.3.3) this field ("whole_object" field) 
> has type ptrdiff_t so the only limitation I can find in the size of an 
> object is 2**31 bytes for a 32 bit machine.

the __base_class_type_info contains an __offset_and_flags field of type
long.  The first 8 bits are flags about the base
     enum __offset_flags_masks
       {
	__virtual_mask = 0x1,
	__public_mask = 0x2,
	__hwm_bit = 2,
	__offset_shift = 8          // Bits to shift offset.
       };

the remaining 56 (or 24 on 32bit systems) bits are the offset to the base
(or offset in the vtable, for virtual bases).  As this includes a sign
bit the base must be within 2^55 (2^23) bytes of the derived object.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan at codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk




More information about the cxx-abi-dev mailing list