aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'common/nextpnr.cc')
-rw-r--r--common/nextpnr.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/nextpnr.cc b/common/nextpnr.cc
index 1156490c..c16a601c 100644
--- a/common/nextpnr.cc
+++ b/common/nextpnr.cc
@@ -23,6 +23,25 @@
#include "log.h"
#include "util.h"
+#if defined(__wasm)
+extern "C" {
+ // FIXME: WASI does not currently support exceptions.
+ void* __cxa_allocate_exception(size_t thrown_size) throw() {
+ return malloc(thrown_size);
+ }
+ bool __cxa_uncaught_exception() throw();
+ void __cxa_throw(void* thrown_exception, struct std::type_info * tinfo, void (*dest)(void*)) {
+ std::terminate();
+ }
+}
+
+namespace boost {
+ void throw_exception( std::exception const & e ) {
+ NEXTPNR_NAMESPACE::log_error("boost::exception(): %s\n", e.what());
+ }
+}
+#endif
+
NEXTPNR_NAMESPACE_BEGIN
assertion_failure::assertion_failure(std::string msg, std::string expr_str, std::string filename, int line)