[cfe-dev] C++ Language Support Library

Sebastian Redl sebastian.redl at getdesigned.at
Mon Nov 10 09:55:20 PST 2008


Doug Gregor wrote:
> On Mon, Nov 10, 2008 at 11:57 AM, Howard Hinnant <hhinnant at apple.com> wrote:
>   
>> On Nov 10, 2008, at 7:50 AM, Doug Gregor wrote:
>>     
>>> The licensing issues dominate, so we'll have to write out own. The
>>> good news is that the primary entry points to libsupc++ are mainly
>>> those functions required by the Itanium C++ ABI that GCC implements,
>>> which is specified here:
>>>
>>>  http://www.codesourcery.com/public/cxx-abi/abi.html
>>>
>>> If we follow that, and allow for some tweaking, we should be able to
>>> maintain compatibility with GCC.
>>>       
>> Are:
>>
>> type_info::__is_pointer_p
>> type_info::__is_function_p
>> type_info::__do_catch
>> type_info::__do_upcast
>>
>> exposed entry points?  These are public virtual functions of the gcc
>> type_info, and are not part of the Itanium C++ ABI.
>>     
>
> None of these functions is actually used by the GNU front end, and the
> ChangeLogs seem to indicate that the compiler stopped using these
> names in 2000. They are all declared protected in libsupc++ and are
> used internally.
>
> That said, I don't have enough of a grasp of the C++ ABI to say
> whether or not any of that matters :)
If these functions truly are called only from within libsupc++ itself, 
then we only need to replicate the data members of the GCC RTTI 
structures, not its virtual table layout. This is because the virtual 
tables of type_info and its derived types are part of the support library.

The most interesting part of the interoperability is exceptions. We can 
claim to throw "GNUCC++\0" exceptions, and GCC code will be able to 
catch them. But then we really have to match GCC exactly in all relevant 
aspects (object layout, mostly).

If we want to be compatible on the object file level (i.e. we want to 
link GCC and Clang object files together), we need to exactly duplicate 
GCC's exception tables. Then, even our personality function will have to 
claim that it is GCC's (i.e. be called __gxx_personality_v0).

Sebastian



More information about the cfe-dev mailing list