diff --git a/Dockerfile b/Dockerfile index 5dd3680..958ba06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,9 +7,9 @@ RUN apt-get update \ make \ cargo -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-11.0-linux.tar.gz | tar xz --strip-components=1 -C / +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz | tar xz --strip-components=1 -C / -RUN cargo install fcli --version 0.1.12 +RUN cargo install fcli --version 0.2.0 VOLUME /code WORKDIR /code diff --git a/Makefile b/Makefile index 21226a0..419a16d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SYSROOT = /share/wasi-sysroot TARGET_TRIPLE = wasm32-wasi CFLAGS = -fvisibility=hidden SDK = sdk/logger.h -LDFLAGS = -Wl,--demangle,--allow-undefined +LDFLAGS = -Wl,--demangle,--allow-undefined,--no-gc-sections EXPORT_FUNCS = \ --export=allocate,$\ --export=deallocate,$\ @@ -123,6 +123,7 @@ SQLITE_SRC = \ src/vdbemem.c\ src/vdbesort.c\ src/vdbetrace.c\ + src/version.c\ src/vtab.c\ src/wal.c\ src/walker.c\ @@ -162,8 +163,7 @@ default: $(TARGET) all: default $(TARGET): $(SQLITE_SRC) $(WRAPPER_SRC) - $(CC) -O3 --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) $(SQLITE_FLAGS) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -o $@.wasm - /root/.cargo/bin/fce embed -i sqlite3.wasm -w sqlite3.wit + $(CC) -O3 --sysroot=$(SYSROOT) --target=$(TARGET_TRIPLE) $(SQLITE_FLAGS) $(CFLAGS) $(LDFLAGS) -Wl,$(EXPORT_FUNCS) $^ -o $@.wasm .PRECIOUS: $(TARGET) diff --git a/src/version.c b/src/version.c new file mode 100644 index 0000000..09e60f0 --- /dev/null +++ b/src/version.c @@ -0,0 +1,4 @@ +#include "sqliteInt.h" + +__attribute__((section(".custom_section.__fluence_sdk_version"))) +static const unsigned char __FCE_SDK_VERSION[6] = "0.5.0"; diff --git a/src/wrapper.c b/src/wrapper.c index 8158d9a..81cb61f 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -4,6 +4,8 @@ const char *RESULT_PTR; int RESULT_SIZE; +const unsigned char __FCE_SDK_VERSION1[6] __attribute__((__section__(".custom_section.__fluence_sdk_version1"))) = "0.5.0"; + void* allocate(size_t size) { return malloc(size + 1); }