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...
@@ -22,8 +22,19 @@ extern "C"
void __cxa_throw(void *thrown_exception, std::type_info *tinfo,
void (*dest)(void *));
+#ifdef __GLIBCXX__
+#include <exception>
+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;
