[Libreoffice-commits] core.git: bridges/source

Stephan Bergmann sbergman at redhat.com
Mon Jun 19 21:26:32 UTC 2017


 bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx |   20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit 7a9dd3d482deeeb3ed1d50074e56adbd3f928296
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jun 19 21:48:12 2017 +0200

    Hack to dynamically adapt to __cxa_exceptiom in LLVM 5.0 libcxxabi
    
    Change-Id: Ibf6379425d312b2cc2c9d663a65d0e02209f74e4
    Reviewed-on: https://gerrit.libreoffice.org/38981
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
index 53fb3c8cabc0..1d1eeccd97ae 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
@@ -256,6 +256,26 @@ std::type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
 static void deleteException( void * pExc )
 {
     __cxa_exception const * header = static_cast<__cxa_exception const *>(pExc) - 1;
+    // The libcxxabi commit
+    // <http://llvm.org/viewvc/llvm-project?view=revision&revision=303175>
+    // "[libcxxabi] Align unwindHeader on a double-word boundary" towards
+    // LLVM 5.0 changed the size of __cxa_exception by adding
+    //
+    //   __attribute__((aligned))
+    //
+    // to the final member unwindHeader, on x86-64 effectively adding a hole of
+    // size 8 in front of that member (changing its offset from 88 to 96,
+    // sizeof(__cxa_exception) from 120 to 128, and alignof(__cxa_exception)
+    // from 8 to 16); a hack to dynamically determine whether we run against a
+    // new libcxxabi is to look at the exceptionDestructor member, which must
+    // point to this function (the use of __cxa_exception in fillUnoException is
+    // unaffected, as it only accesses members towards the start of the struct,
+    // through a pointer known to actually point at the start):
+    if (header->exceptionDestructor != &deleteException) {
+        header = reinterpret_cast<__cxa_exception const *>(
+            reinterpret_cast<char const *>(header) - 8);
+        assert(header->exceptionDestructor == &deleteException);
+    }
     typelib_TypeDescription * pTD = nullptr;
     OUString unoName( toUNOname( header->exceptionType->name() ) );
     ::typelib_typedescription_getByName( &pTD, unoName.pData );


More information about the Libreoffice-commits mailing list