aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-05-24 14:23:35 +0100
committerGitHub <noreply@github.com>2020-05-24 14:23:35 +0100
commitf44498a5301f9f516488fb748c684926be514346 (patch)
treed37948e9ad90850c2d90566cebc5dc6d4ac07fb9 /common/nextpnr.cc
parent2d406f3e275beda8b70b4c7d4d5e43433dd3c43c (diff)
parente7bb04769d5d7262d3ecfd0de49953078174a880 (diff)
downloadnextpnr-f44498a5301f9f516488fb748c684926be514346.tar.gz
nextpnr-f44498a5301f9f516488fb748c684926be514346.tar.bz2
nextpnr-f44498a5301f9f516488fb748c684926be514346.zip
Merge pull request #447 from whitequark/wasi
Port nextpnr-{ice40,ecp5} to WASI
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)