From 55a4719976b96df1c684052851249d7af121ffb3 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Sat, 23 Nov 2019 22:05:10 +0000 Subject: [PATCH] Attempt to fix libsupc++ support. Recent versions of libstdc++ appear to have lost the clean layering between libstdc++ and libsupc++, so use the high-level APIs and some pointer evilness to fudge the low-level ones... --- objcxx_eh.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/objcxx_eh.cc b/objcxx_eh.cc index ade63cc..6cea852 100644 --- a/objcxx_eh.cc +++ b/objcxx_eh.cc @@ -22,8 +22,19 @@ extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest)(void *)); +#ifdef __GLIBCXX__ +#include +static void *__cxa_current_primary_exception() +{ + std::exception_ptr p = std::current_exception(); + void *obj = *(void**)&p; + *(void**)&p = nullptr; + return obj; +} +#else extern "C" void *__cxa_current_primary_exception(); +#endif using namespace __cxxabiv1;