summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-19 21:48:12 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-06-19 23:26:05 +0200
commit7a9dd3d482deeeb3ed1d50074e56adbd3f928296 (patch)
tree3a61c5fcbd5485d73cae206e30a7e2a3a146c7b3 /bridges
parentf991b842addddeada6dc45c4054deeca5aa7f17b (diff)
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@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx20
1 files changed, 20 insertions, 0 deletions
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 );