bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 146eb1aa750a7612deb9d3e1825a7a2e1256bd4d
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Jan 4 08:34:34 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Jan 4 09:46:00 2023 +0000

    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 <sberg...@redhat.com>

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;
 }
 

Reply via email to