Under the relative vtables ABI, __dynamic_cast will not work since it assumes the vtable pointer is 2 ptrdiff_ts away from the start of the vtable (8-byte offset to top + 8-byte pointer to typeinfo) when it is actually 8 bytes away (4-byte offset to top + 4-byte offset to typeinfo). This adjusts the logic under __dynamic_cast to support this ABI when it's used.
ldionne howard.hinnant mcgrathr
- Group Reviewers
- rG61aec69a65de: [libcxxabi] Add macro for changing functions to support the relative vtables ABI
Just to be clear, is this enabled whenever the compiler *supports* the feature, or whenever the feature is actually turned on?
The former would be incorrect, because any sufficiently recent Clang would take that code path. The latter is what we want.
Are you certain this is the only place where code needs changing? For example we seem to extract the vtable in __base_class_type_info::search_above_dst and other functions -- don't they need to be changed too?