04-wasm-exceptions.patch 785 B

123456789101112131415161718192021222324252627
  1. --- contrib/libs/libunwind/src/Unwind-wasm.c
  2. +++ contrib/libs/libunwind/src/Unwind-wasm.c
  3. @@ -14,9 +14,10 @@
  4. #include "config.h"
  5. -#ifdef __WASM_EXCEPTIONS__
  6. #include "unwind.h"
  7. +
  8. +#ifdef __WASM_EXCEPTIONS__
  9. #include <threads.h>
  10. _Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
  11. @@ -120,4 +121,12 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context __attribute__((unused)))
  12. return 0;
  13. }
  14. +#elif defined(__EMSCRIPTEN__)
  15. +/// Called by __cxa_throw.
  16. +/// Define it here to prevent linker errors if we're buildingig Wasm modules
  17. +/// without exception support.
  18. +_LIBUNWIND_EXPORT _Unwind_Reason_Code
  19. +_Unwind_RaiseException(_Unwind_Exception *exception_object __attribute__((unused))) {
  20. + abort();
  21. +}
  22. #endif // defined(__WASM_EXCEPTIONS__)