You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2020/12/11 12:34:21 UTC

[openoffice] branch AOO42X updated: We need to account for the cases where the struct differs due to the runtime environ. Ugg. Sometimes pointers are your friend.

This is an automated email from the ASF dual-hosted git repository.

jim pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO42X by this push:
     new d890f63  We need to account for the cases where the struct differs due to the runtime environ. Ugg. Sometimes pointers are your friend.
d890f63 is described below

commit d890f63926cbb7538b1d5beeea4c6b68a8b00ed8
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Fri Dec 11 07:33:12 2020 -0500

    We need to account for the cases where the struct differs due
    to the runtime environ. Ugg. Sometimes pointers are your friend.
---
 .../source/cpp_uno/gcc3_macosx_x86-64/except.cxx     | 20 ++++++++++++++++++++
 .../source/cpp_uno/gcc3_macosx_x86-64/share.hxx      |  6 +++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
index bf62e2f..e17cd06 100644
--- a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
+++ b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
@@ -304,6 +304,26 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping
         return;
     }
 
+    /*
+     * Handle the case where we are built on llvm 10 (or later) but are running
+     * on an earlier version (eg, community builds). In this situation the
+     * reserved ptr doesn't exist in the struct returned and so the offsets
+     * that header uses are wrong. This assumes that reserved isn't used
+     * and that referenceCount is always >0 in the cases we handle
+     */
+    {
+        void ** oheader = reinterpret_cast<void **>(header);
+        // Does this look like the struct __cxa_exception we were compiled w/?
+        // Agreed, this looks excessive, but this is wonky stuff
+        if (!*oheader && *(oheader+1) && *(oheader+2)) {
+            ; // It is... cool
+        } else {
+            // Nope. it is pre llvm 10. So we back up a slot to offset
+            oheader--;  //
+            header = reinterpret_cast<__cxa_exception *>(oheader);  // type warnings
+        }
+    }
+
 	typelib_TypeDescription * pExcTypeDescr = 0;
     OUString unoName( toUNOname( header->exceptionType->name() ) );
 #if OSL_DEBUG_LEVEL > 1
diff --git a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
index c248532..eeb118e 100644
--- a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
+++ b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
@@ -48,11 +48,11 @@ struct _Unwind_Exception
 struct __cxa_exception
 {
 #if __LP64__
-#if ( COM = CLANG ) && ( CCNUMVER >= 1000000000 )
     // From LLVM 10 - Added reserved member at top of struct. Who the hell does that?
     // https://reviews.llvm.org/rG674ec1eb16678b8addc02a4b0534ab383d22fa77
-    void *dummy;
-#endif
+    // Sure would be nice to be able to test for CCNUMVER >= 1000000000
+    // and COM == CLANG here.
+    void *reserved;
     // ----- from libcxxabi/src/cxa_exception.hpp
     // This is a new field to support C++ 0x exception_ptr.
     // For binary compatibility it is at the start of this