libc++ compiled with libstdc++ ABI and cxxabi.h / std::typeinfo


I'm currently trying to build libc++ with a clang cross-compiler, but
using libstd++ as ABI to keep some kind of compatibility between
libraries built with libc++ and libstdc++ (as long as no STL objects
are shared of course).
This means building with -DLIBCXX_CXX_ABI=libstdc++

libc++ compiles correctly, but when including cxxabi.h from
application code (for __cxa_demangle) :
/.../sysroot/usr/include/c++/v1/cxxabi.h:52:10: fatal error:
'bits/cxxabi_init_exception.h' file not found

It's easy to add bits/cxxabi_init_exception.h (added in gcc 7) to

But then I have another issue with std::typeinfo :
/.../sysroot/usr/include/c++/v1/cxxabi.h:308:23: error: no member
named '__do_catch' in 'std::type_info'

libc++ has its own typeinfo header, which doesn't match the libsupc++ one.
Aren't the std::typeinfo supposed to be compatible ? The libsupc++ one
has 4 additional virtual methods.
The vtables for std::typeinfo and __cxxabiv1::__*_type_info are in, so if the code calling the virtual methods in libsupc++
gets called it might work.

I added _LIBCPP_ABI_GLIBCXX to __config, and the virtual methods to typeinfo :
#if defined(_LIBCPP_ABI_GLIBCXX)
namespace __cxxabiv1
    class __class_type_info;
#if defined(_LIBCPP_ABI_GLIBCXX)
    virtual bool __is_pointer_p() const;
    virtual bool __is_function_p() const;
    virtual bool __do_catch(const type_info*, void**, unsigned) const;
    virtual bool __do_upcast(const __cxxabiv1::__class_type_info*,
void**) const;

This is enough to build (and to make sure the vtable would be correct
if someone derived from std::type_info), but I wonder if this is the
proper solution.