This commit is contained in:
vms 2021-03-13 00:57:25 +03:00
parent 15384f3ab1
commit 490026bc0f
4 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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)

4
src/version.c Normal file
View File

@ -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";

View File

@ -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);
}