On Tue, Jan 23, 2024 at 9:05 PM Thiago Macieira wrote:

    void const *get_polymorphic_facilitator(type_info const &ti)
    {
        auto ti2 = dynamic_cast<abi::__vmi_class_type_info2 *>(&ti);
        return t2 ? t2->vtable : nullptr;
    }

Second, even that is not necessary, because __vmi_class_type_info has a flags
field, so the ABI could dedicate another bit to indicating whether this one has
the extra field at the end.


This is a good idea . . . and I was almost about to ditch my idea of editing the source code for the GNU linker in favour of your idea, but your solution has one drawback:

    - - - Objective files and static archives need to be recompiled - - -

If I only edit the linker, then big projects only need to be re-linked. No need to recompile all the object files, nor the static libraries.

Here's where I am so far on editing the GNU linker:

    https://github.com/bminor/binutils-gdb/compare/f11786a1951932217d348f3739e8deb31975a355...healytpk:linker-vtable:master

(The code for managing the list of symbol strings is thrown together and probably contains a bug for some corner cases, I'll fix/replace it before finalising)