diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2023-08-20 16:20:03 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2023-08-27 00:46:09 +0100 |
commit | a1998f2f7ce4153d670e2e5cb5018366517cc1ca (patch) | |
tree | 4d899fbad24c728c0b51f183c61ed6a7fb213c04 /src/abi.h | |
parent | 38fa6c52a8a26ac178a3e1f80a8317740b8e82b3 (diff) |
Get things at least compiling under Linux
Nothing really works yet, but at least test.h and fastspin are fixed and
some of the issues with RTTI and libdl and stuff are maybe kind of
sorted, subject to more testing later.
The main issue now seems to be the cvar interface not quite lining up
and crashing pretty much immediately. That'll probably take a lot more
debugging to figure out, which likely still won't be a priority for
quite a while.
Diffstat (limited to 'src/abi.h')
-rw-r--r-- | src/abi.h | 50 |
1 files changed, 37 insertions, 13 deletions
@@ -74,7 +74,7 @@ struct msvc_rtti_locator { // I mean seriously look at this crap! #define DEF_MSVC_BASIC_RTTI(mod, name, vtab, typestr) \ -const mod struct msvc_rtti_locator name; \ +mod const struct msvc_rtti_locator name; \ static const struct { \ struct msvc_rtti_descriptor_head d; \ char classname[sizeof("" typestr)]; \ @@ -93,24 +93,48 @@ mod const struct msvc_rtti_locator name = { \ #else -#warning FIXME! More stuff needs to be implemented/fixed here! +struct itanium_type_info_vtable { + void *dtor1, *dtor2; +}; struct itanium_type_info { - struct itanium_type_info_vtable { - void *dtor1, *dtor2; // ??? - // there's some more functions here in libstdc++: is_pointer, - // is_function, do_catch, etc. however they're not specified in itanium - // abi doc. hoping to do without them, but we'll see I guess - } *vtable; + struct itanium_type_info_vtable *vtable; const char *name; }; +struct itanium_vmi_type_info { + struct itanium_type_info base; + uint flags; + uint nbases; + // then there's a flexible array of `__base_class_type_info`s, but for our + // purposes we can just have zero bases and avoid dealing with more nonsense +}; + +struct itanium_type_info_vtable_wrapper { + // Oh CHRIST, Unix RTTI is bonkers too. Each type_info is itself one of + // several subclasses with its own RTTI; the RTTI has RTTI! + ssize topoffset; + struct itanium_type_info *rtti; + struct itanium_type_info_vtable vtable; +}; + +// `typeinfo for __cxxabiv1::__vmi_class_type_info` in libcxxabi - type_info +// comparison is identity-based, so we need to import this from a shared object +// in order to implement the same ABI. I honestly don't know whether this or the +// MSVC design is more stupid. +extern struct itanium_type_info _ZTIN10__cxxabiv121__vmi_class_type_infoE; + +// XXX: just static for now, as only used for cvars and lto would dedupe anyway. +static void _itanium_type_info_dtor(void *this) {} + #define DEF_ITANIUM_BASIC_RTTI(mod, name, typestr) \ - mod struct itanium_type_info name = { \ - &(struct itanium_type_info_vtable){ \ - 0, 0 /* FIXME/TEMP: definitely need real functions here! */ \ - }, \ - typestr \ + mod const struct itanium_vmi_type_info name = { \ + &(struct itanium_type_info_vtable_wrapper){ \ + 0, &_ZTIN10__cxxabiv121__vmi_class_type_infoE, \ + (void *)&_itanium_type_info_dtor, (void *)&_itanium_type_info_dtor \ + }.vtable, \ + typestr, \ + 0, 0 \ }; #endif |