summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-01-04 08:34:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-01-04 09:46:00 +0000
commit146eb1aa750a7612deb9d3e1825a7a2e1256bd4d (patch)
tree8587662a1cfeb3b315d70956ae37aa40c99bdc16 /bridges
parent3fd787428f5e16c74018f5aa3399cb469c97587a (diff)
Fix Itanium vtable construction
Our use of bridges::cpp_uno::shared::VtableFactory::Slot to model all the elements of a vtable is an abstraction that doesn't quite match the reality of <https://itanium-cxx-abi.github.io/cxx-abi/abi.html>, as vtables are not homogenous sequences of function pointers, but are rather a mix of offsets, data pointers, and function pointers. The data preceding the virtual table address point is the offset to top (an offset) followed by the typeinfo pointer (a data pointer). On other platforms where offsets, data pointers, and function pointers are all of the same size, we model those as two additional Slots at index -2 and -1, resp. On Itanium, where function pointers (and thus Slots) are twice the offset and data pointer size, we should model those as one additional Slot at index -1. The code has been this way ever since its introduction in 0c25631972809c752624b4883c71671c8e83e797 "INTEGRATION: CWS ia64port01_DEV300 (1.1.2); FILE ADDED". It should never have caused any issues as the existence of the excess Slot at index -2 should never have gotten in the way. But it is probably better to clean this up anyway. (This is a blind fix, as I don't have an Itanium build environment available. And this Itanium bridge may well be dead code by now, anyway.) Change-Id: I98d58785c054e1cdc621e5968c41b06d8788998f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145035 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx
index 2cf39d998556..ddcd40818036 100644
--- a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx
@@ -597,22 +597,20 @@ void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *, u
bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
{
- return static_cast< Slot * >(block) + 2;
+ return static_cast< Slot * >(block) + 1;
}
std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize(
sal_Int32 slotCount)
{
- return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
+ return (slotCount + 1) * sizeof (Slot) + slotCount * codeSnippetSize;
}
bridges::cpp_uno::shared::VtableFactory::Slot* bridges::cpp_uno::shared::VtableFactory::initializeBlock(void * block, sal_Int32 slotCount, sal_Int32, typelib_InterfaceTypeDescription *)
{
Slot * slots = mapBlockToVtable(block);
- Slot foo = {0,0};
- slots[-2] = foo;
- slots[-1] = foo;
+ slots[-1] = {0,0};
return slots + slotCount;
}