diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-12-13 07:23:04 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-06-05 22:19:25 +0200 |
commit | 86560e6a675ea409c1f8408c38facfdfb904be72 (patch) | |
tree | 056445b99eebaa36e41af47b62bf0429f684595a | |
parent | a4c882dc7dfc3f2578fea57b97441ec1a11db3d6 (diff) |
Fix getRTTI for Android x86
First, make sure existing compiler-generated RTTI from liblo-native-code.so is
found (so that catching bridge-synthesized exceptions in native code works with
libc++abi, which checks type equivalence by address instead of string
comparsion), by using the dlsym(RTLD_DEFAULT,...) mechanism as in the ANDROID
gcc3_linux_arm bridge case. And second, if that should fail, synthesize the
type_info even if the included cxxabi.h doesn't provide the relevant type
declarations, by using copies from the ABI specification, as also done on other
platforms.
Instead of always having getRTTI fail and raiseException throw a non-synthesized
css::uno::RuntimeException("no rtti for type ..."). Which explains the mystery
discussed in the commit message of 312eeeee42cb4a1e356943e17305555e41afc4ef
"Switch Android armeabi-v7a to libc++/libc++abi/libunwind too", why the observed
misbehavior on x86 was so different from that on armeabi-v7a.
Change-Id: I9308654c5c2b88b4d27e0e8e9edda1849133a161
Reviewed-on: https://gerrit.libreoffice.org/65070
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_intel/except.cxx | 10 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_intel/share.hxx | 27 |
2 files changed, 37 insertions, 0 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx index 6bbcfb2565c1..d5567ed6216c 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx @@ -90,7 +90,9 @@ class RTTI t_rtti_map m_rttis; t_rtti_map m_generatedRttis; +#if defined ANDROID void * m_hApp; +#endif public: RTTI(); @@ -100,13 +102,17 @@ public: }; RTTI::RTTI() +#if !defined ANDROID : m_hApp( dlopen(nullptr, RTLD_LAZY) ) +#endif { } RTTI::~RTTI() { +#if !defined ANDROID dlclose( m_hApp ); +#endif } @@ -135,7 +141,11 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) buf.append( 'E' ); OString symName( buf.makeStringAndClear() ); +#if !defined ANDROID rtti = static_cast<type_info *>(dlsym( m_hApp, symName.getStr() )); +#else + rtti = static_cast<type_info *>(dlsym( RTLD_DEFAULT, symName.getStr() )); +#endif if (rtti) { diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx index d167bf25c584..5b9792405462 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx @@ -33,6 +33,33 @@ #include <uno/any2.h> #include "uno/mapping.h" +#if !HAVE_CXXABI_H_CLASS_TYPE_INFO +// <https://mentorembedded.github.io/cxx-abi/abi.html>, +// libstdc++-v3/libsupc++/cxxabi.h: +namespace __cxxabiv1 { +class __class_type_info: public std::type_info { +public: + explicit __class_type_info(char const * n): type_info(n) {} + ~__class_type_info() override; +}; +} +#endif + +#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO +// <https://mentorembedded.github.io/cxx-abi/abi.html>, +// libstdc++-v3/libsupc++/cxxabi.h: +namespace __cxxabiv1 { +class __si_class_type_info: public __class_type_info { +public: + __class_type_info const * __base_type; + explicit __si_class_type_info( + char const * n, __class_type_info const *base): + __class_type_info(n), __base_type(base) {} + ~__si_class_type_info() override; +}; +} +#endif + namespace CPPU_CURRENT_NAMESPACE { |