summaryrefslogtreecommitdiffstats
path: root/contrib/libs/libunwind/patches/04-wasm-exceptions.patch
blob: 167b0a5d7833138dac951b1ebbd27997248f1c67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- contrib/libs/libunwind/src/Unwind-wasm.c
+++ contrib/libs/libunwind/src/Unwind-wasm.c
@@ -14,9 +14,10 @@

 #include "config.h"

-#ifdef __WASM_EXCEPTIONS__

 #include "unwind.h"
+
+#ifdef __WASM_EXCEPTIONS__
 #include <threads.h>

 _Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
@@ -120,4 +121,12 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context __attribute__((unused)))
   return 0;
 }

+#elif defined(__EMSCRIPTEN__)
+/// Called by __cxa_throw.
+/// Define it here to prevent linker errors if we're buildingig Wasm modules
+/// without exception support.
+_LIBUNWIND_EXPORT _Unwind_Reason_Code
+_Unwind_RaiseException(_Unwind_Exception *exception_object __attribute__((unused))) {
+  abort();
+}
 #endif // defined(__WASM_EXCEPTIONS__)