aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine_cxxabi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4engine_cxxabi.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine_cxxabi.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine_cxxabi.cpp b/src/qml/jsruntime/qv4engine_cxxabi.cpp
index 02a6b9bdde..dfe1db8fe3 100644
--- a/src/qml/jsruntime/qv4engine_cxxabi.cpp
+++ b/src/qml/jsruntime/qv4engine_cxxabi.cpp
@@ -136,4 +136,37 @@ void ExecutionEngine::rethrowInternal()
QT_END_NAMESPACE
+/*
+ * We override these EABI defined symbols on Android, where we must statically link in the unwinder from libgcc.a
+ * and thus also ensure that compiler generated cleanup code / landing pads end up calling these stubs, that
+ * ultimately return control to our copy of the unwinder. The symbols are also exported from gnustl_shared, which
+ * comes later in the link line.
+ */
+#if defined(__ANDROID__) && defined(__ARM_EABI_UNWINDER__)
+#pragma GCC visibility push(default)
+#ifdef __thumb__
+asm (" .pushsection .text.__cxa_end_cleanup\n"
+" .global __cxa_end_cleanup\n"
+" .type __cxa_end_cleanup, \"function\"\n"
+" .thumb_func\n"
+"__cxa_end_cleanup:\n"
+" push\t{r1, r2, r3, r4}\n"
+" bl\t__gnu_end_cleanup\n"
+" pop\t{r1, r2, r3, r4}\n"
+" bl\t_Unwind_Resume @ Never returns\n"
+" .popsection\n");
+#else
+asm (" .pushsection .text.__cxa_end_cleanup\n"
+" .global __cxa_end_cleanup\n"
+" .type __cxa_end_cleanup, \"function\"\n"
+"__cxa_end_cleanup:\n"
+" stmfd\tsp!, {r1, r2, r3, r4}\n"
+" bl\t__gnu_end_cleanup\n"
+" ldmfd\tsp!, {r1, r2, r3, r4}\n"
+" bl\t_Unwind_Resume @ Never returns\n"
+" .popsection\n");
+#endif
+#pragma GCC visibility pop
+#endif
+
#endif