[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - bridges/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 30 18:00:18 UTC 2019
bridges/source/cpp_uno/gcc3_linux_intel/except.cxx | 16 +++++++-----
bridges/source/cpp_uno/gcc3_linux_intel/share.hxx | 27 +++++++++++++++++++++
2 files changed, 37 insertions(+), 6 deletions(-)
New commits:
commit 486b7644ca550321048770c0e185783c21e924c3
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Dec 13 07:23:04 2018 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Oct 30 18:59:16 2019 +0100
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 at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/81783
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index ad3350d50fc5..3a8e5753b053 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)
{
@@ -156,9 +166,6 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr,"generated rtti for %s\n", rttiName );
#endif
-// TODO: incompatible with llvm-c++ in ndk16 - no __si_class_type_info or __class_type_info
-// either do as iOS one and inline thing or find another way
-#if !defined(ANDROID)
if (pTypeDescr->pBaseTypeDescription)
{
// ensure availability of base
@@ -176,7 +183,6 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
SAL_WARN_IF( !insertion.second, "bridges", "### inserting new generated rtti failed?!" );
-#endif
}
else // taking already generated rtti
{
@@ -242,9 +248,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
static RTTI rtti_data;
rtti = rtti_data.getRTTI(reinterpret_cast<typelib_CompoundTypeDescription*>(pTypeDescr));
TYPELIB_DANGER_RELEASE( pTypeDescr );
-#if !defined(ANDROID) // see TODO above
assert(rtti && "### no rtti for throwing exception!");
-#endif
if (! rtti)
{
throw RuntimeException(
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
index fb8f25353918..39325c84e7ea 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
{
More information about the Libreoffice-commits
mailing list