diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-07-10 17:01:47 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-17 11:26:32 +0200 |
commit | a62e32cae6606db64632e418262ab01e7806480c (patch) | |
tree | 6112b70be61f6796b8d84289600d016c8eafeebe /.qmake.conf | |
parent | 54435e420671b5f77e724260516d4154aef245ac (diff) |
Implement gcc compatible exception throwing using _Unwind_RaiseException
On ARM/Android we have the problem of not being able to inject the ARM
exception unwind tables into the exception handling run-time - we need to be
able to override the __gnu_Unwind_Find_exidx symbol, which is weakly declared
in libgcc and strong in libc or the dynamic linker.
The solution is to avoid throwing the exception from within libstdc++ but
instead do it ourselves and include the unwinding code along with it, so that
we can replace the symbol. This works by throwing the exception the way the
standard describes __cxa_throw() works, eventually calling
_Unwind_RaiseException. That function in turn will (indirectly) reference
__gnu_Unwind_Find_exidx. If our code references _Unwind_RaiseException and we
link libgcc statically, then the linker will include all the dependencies of
_Unwind_RaiseException in our library, including the resolution of the weak
__gnu_Find_exidx symbol to our implementation in qv4unwindhelper_p-arm.h.
The "catch" with this approach is that it relies on the layout of the exception
object in libstdc++, which deviates from the standard by an added reference
count. The code in question has NOT changed in years, so for now that's a risk
we accept.
A different solution that only depends on the cross-vendor C++ ABI (implemented
by pretty much any compiler other than MSVC that we support) would be to not
throw a pure C++ exception but a foreign exception (still ABI compliant
__cxa_exception, but with a different class). The GNU personality routine would
still catch it if we used catch (...), and we could get hold of the
__cxa_exception pointer via the standardized __cxa_get_globals(). But that in
turn would require replacing the use of "catch (QV4::Exception &e) { ..." in
our client code with macros that abstract away the difference between the win32
C++ based exceptions and the CXX ABI way, thus making the catch code a little
uglier.
Change-Id: I3f9bfaa9f657e80ebe4f88369cf51922367570b1
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to '.qmake.conf')
0 files changed, 0 insertions, 0 deletions