Fix cleanup handlers on Android when exceptions are thrown
authorSimon Hausmann <simon.hausmann@digia.com>
Tue, 15 Oct 2013 10:42:24 +0000 (12:42 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 16 Oct 2013 04:36:27 +0000 (06:36 +0200)
commit0c6743749f8bab4bbace3f3c3d1172d1ca959f7c
tree39f3abafd4249b171181bf2b44b81e600633c514
parent4e45120a7b593cfafccb5cd7b7c7645afffc37c4
Fix cleanup handlers on Android when exceptions are thrown

When an exception is thrown and we traverse a frame that requires only cleanup
(i.e. call QV4::Scope::~Scope), control is first transferred to the generated
cleanup code. Afterwards the unwinding is resumed (on ARM) by calling
__cxa_end_cleanup, which resides in libsupc++ (libgnustl_shared).
__cxa_end_cleanup first calls __gnu_end_cleanup and then resumes the process of
stack unwinding by calling _Unwind_Resume (per specification). Given the
linking situation on Android, this will end up calling _Unwind_Resume inside
libgnustl_shared, which sidesteps our statically linked copy of the unwind
code in QtQml (libgcc.a). Therefore any further unwinding through JIT generated
frames will fail.

This patch introduces the same EABI symbol exported in libQt5Qml, which will
direct control to the correct JIT aware unwinder.

This relies on https://codereview.qt-project.org/#change,68206 in order to
ensure that libsupc++.a is gone from all link lines (not needed) and that
gnustl_shared is after libQt5Qml.

Task-Number: QTBUG-33892

Change-Id: I6ed691db3ceb287475a70b7af8cf3cd7b4ddfdd6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/jsruntime/qv4engine_cxxabi.cpp