diff --git a/common/interpreter/wawaka_wasm/README.md b/common/interpreter/wawaka_wasm/README.md index 5fa32786..91855386 100644 --- a/common/interpreter/wawaka_wasm/README.md +++ b/common/interpreter/wawaka_wasm/README.md @@ -30,8 +30,8 @@ enclave with Wawaka enabled, you will need to do the following: There are many toolchains that could be used to build a WASM code. By default, Wawaka contracts are compiled with the compilers provided by [WASI SDK](https://github.com/WebAssembly/wasi-sdk). To use WASI SDK, download and install the appropriate package file from -https://github.com/WebAssembly/wasi-sdk/releases (we have verified that release wasi-sdk-12 works -with WAMR version WAMR-1.1.2). +https://github.com/WebAssembly/wasi-sdk/releases (we have verified that release wasi-sdk-21 works +with WAMR version WAMR-1.3). ```bash wget -q -P /tmp https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk_12.0_amd64.deb @@ -46,14 +46,14 @@ SDK would be installed in the directory `/opt/wasi-sdk`. If wawaka is configured as the contract interpreter, the libraries implementing the WASM interpreter will be built for use with Intel SGX. The source for the WAMR interpreter is included as a submodule in the interpreters/ folder, and will -always point to the latest tagged commit that we have validated: `WAMR-1.1.2`. +always point to the latest tagged commit that we have validated: `WAMR-1.3`. If the PDO parent repo was not cloned with the `--recurse-submodules` flag, you will have to explictly pull the submodule source. ``` cd ${PDO_SOURCE_ROOT}/interpreters/wasm-micro-runtime git submodule update --init -git checkout WAMR-1.1.2 # optional +git checkout WAMR-1.3 # optional ``` The WAMR API is built during the Wawaka build, so no additional diff --git a/contracts/wawaka/common/Util.cpp b/contracts/wawaka/common/Util.cpp index 175e7b02..5807cae5 100644 --- a/contracts/wawaka/common/Util.cpp +++ b/contracts/wawaka/common/Util.cpp @@ -18,12 +18,20 @@ #include "Types.h" #include "Util.h" +#include "WasmExtensions.h" #ifdef USE_WASI_SDK #include -// this function does not appear to be defined in the wasi-sdk -// lib c++. we need +// ----------------------------------------------------------------- +// these functions do not appear to be defined in the wasi-sdk +// lib c++. an error is generally raised about the failure to link +// an import function. for ones with obvious implements like standard +// new and delete, we provide viable implementation. for others that +// are not supported, a message will be generated and the application +// will abort. +// ----------------------------------------------------------------- + std::new_handler std::get_new_handler() _NOEXCEPT { return NULL; @@ -39,11 +47,32 @@ void * operator new[](size_t sz) throw(std::bad_alloc) return malloc(sz); } +void * operator new(size_t sz, std::align_val_t v) +{ + CONTRACT_SAFE_LOG(4, "attempt to invoke unsupported aligned allocation"); + std::abort(); +} + void operator delete(void *ptr) _NOEXCEPT { free(ptr); } +void operator delete(void *ptr, std::align_val_t) _NOEXCEPT +{ + CONTRACT_SAFE_LOG(4, "attempt to invoke unsupported aligned deallocation"); + std::abort(); +} + +#include +int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list) +{ + CONTRACT_SAFE_LOG(4, "attempt to invoke unsupported vfprintf"); + std::abort(); + + return -1; +} + #endif /* ----------------------------------------------------------------- * diff --git a/docker/pdo_base.dockerfile b/docker/pdo_base.dockerfile index 0abac789..6ecf456e 100644 --- a/docker/pdo_base.dockerfile +++ b/docker/pdo_base.dockerfile @@ -68,7 +68,8 @@ RUN apt-get update \ # ----------------------------------------------------------------- # Install WASI toolkit # ----------------------------------------------------------------- -ARG WASI_VERSION=12 +##ARG WASI_VERSION=12 +ARG WASI_VERSION=21 ARG WASI_PACKAGE="wasi-sdk_${WASI_VERSION}.0_amd64.deb" WORKDIR /tmp