зеркало из https://github.com/mozilla/gecko-dev.git
3a56bcbaeb
In the Itanium C++ ABI VTables contain extra fields before the virtual function pointer list for RTTI information, and these fields are not eliminated even when RTTI is disabled using -fno-rtti. The two relevant fields for rust-xpcom's vtables are the "offset to top" field, which contains the displacement to the top of the object from the corresponding vtable pointer as a `ptrdiff_t` (`isize`), and the "typeinfo pointer" field which points to the typeinfo object and is null when building with -fno-rtti. The VTable pointer points after these fields to the beginning of the virtual function pointer list. While these extra fields would generally not be accessed in -fno-rtti situations, gcc and clang still support `dynamic_cast<void*>` even when -fno-rtti is passed, meaning that the "offset to top" field should be present. Although I was unable to find documentation for the C++ ABI used on Darwin, it appears to behave the same as the Itanium C++ ABI when it comes to VTable layout. In order to include these fields in the manual vtables built by the rust-xpcom macros, a `&'static VTableExtra<VTableType>` is used instead of directly using the vtable type, and the vtable reference stored in the struct is offset into the allocation. As the only platform I know of to not include these extra fields is Windows, they are generated on all non-Windows platforms. Differential Revision: https://phabricator.services.mozilla.com/D115085 |
||
---|---|---|
.. | ||
base | ||
build | ||
components | ||
docs | ||
ds | ||
glue | ||
idl-parser | ||
io | ||
libxpt/xptcall | ||
reflect | ||
rust | ||
string | ||
system | ||
tests | ||
threads | ||
windbgdlg | ||
xpidl | ||
moz.build | ||
xpcom-config.h.in |