summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2020-08-09 10:51:22 +0100
committerTor Lillqvist <tml@collabora.com>2020-08-10 17:51:27 +0200
commite2bd5afd726abd5df438b6b821416bd7cf496e4d (patch)
treed7376196ff0baafaa5904bf454f93974eda87a93 /cppuhelper
parent301b56f92b9058731f76e32604a771cac460693d (diff)
Make the C++/UNO bridge work to some extent on macOS on arm64
Use the same code as for Linux on aarch64, with minor additional hacks. But that will not actually work in all cases, as there are slight differences in the ABI. See https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html Thus we can drop the use of the lo_mobile_throwException() hack that was very temporarily used. The run-time code generation requires use of a new API on macOS to work: See the use of pthread_jit_write_protect_np() in bridges/source/cpp_uno/shared/vtablefactory.cxx. For some reason, with the Xcode 12 betas, when compiling for arm64-apple-macos, the symbols for the type_infos for the UNO exception types (_ZTIN3com3sun4star3uno16RuntimeExceptionE etc) end up as "weak private external" in the object file, as displayed by "nm -f darwin". We try to look them up with dlsym(), but that then fails. So use a gross hack: Introduce separate real variables that point to these typeinfos, and look up and dereference them instead. If this hack ends up needing to be permanent, instead of having a manually edited set of such pointer variables, we should teach codemaker to generate corresponding functions, and look up and invoke them to get the std::type_info pointer. When compiling for x86_64-apple-macos, the type_info symbols end up as "weak external" which is fine. With this, LibreOffice starts and seems to work to some extent, and many unit tests succeed. Change-Id: I05f46a122a51ade1ac7dccd57cb90e594547740e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100408 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/exc_thrower.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
index 2963572e4770..7c40d12db16e 100644
--- a/cppuhelper/source/exc_thrower.cxx
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -173,7 +173,7 @@ ExceptionThrower::ExceptionThrower()
class theExceptionThrower : public rtl::Static<ExceptionThrower, theExceptionThrower> {};
-#if defined(IOS) || (defined(__aarch64__) && (defined(ANDROID) || defined(MACOSX)))
+#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
// In the native iOS / Android app, where we don't have any Java, Python,
// BASIC, or other scripting, the only thing that would use the C++/UNO bridge
// functionality that invokes codeSnippet() was cppu::throwException().
@@ -211,7 +211,7 @@ void lo_mobile_throwException(css::uno::Any const& aException)
assert(false);
}
-#endif // defined(IOS) || (defined(__aarch64__) && (defined(ANDROID) || defined(MACOSX)))
+#endif // defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
} // anonymous namespace
@@ -229,7 +229,7 @@ void SAL_CALL throwException( Any const & exc )
"(must be derived from com::sun::star::uno::Exception)!" );
}
-#if defined(IOS) || (defined(__aarch64__) && (defined(ANDROID) || defined(MACOSX)))
+#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
lo_mobile_throwException(exc);
#else
Mapping uno2cpp(Environment(UNO_LB_UNO), Environment::getCurrent());