Skip to content

Commit

Permalink
chore: bump build image and rust version, include memory features (#4)
Browse files Browse the repository at this point in the history
* chore: bump build image and rust version

* chore: bump versions again

* fix: use proper rustflags to include memory allocation info

* chore: bump versions, update config.toml

* fix: expose `commit_pages` to test

* fix: `commit_pages` in the `wasm_snapshot_preview1` namespace
  • Loading branch information
pepperoni505 authored Nov 14, 2024
1 parent 4388d15 commit 0bd26e3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
19 changes: 16 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
[target.wasm32-wasi]
rustflags = [
"-Ctarget-feature=-crt-static,+bulk-memory",
"-Clink-self-contained=no",
"-Clink-arg=-l",
"-Clink-arg=c",
"-Clink-arg=/workdir/MSFS_SDK/WASM/wasi-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a",
"-Clink-arg=-L",
"-Clink-arg=/workdir/MSFS_SDK/WASM/wasi-sysroot/lib/wasm32-wasi",
"-Clink-arg=--export-table",
"-Clink-arg=--allow-undefined",
"-Clink-arg=--export-dynamic",
"-Clink-arg=--export=__wasm_call_ctors",
"-Clink-arg=--export=malloc",
"-Clink-arg=--export=free",
"-Clink-arg=-L/usr/lib/llvm-15/lib/clang/15.0.7/lib/wasi",
"-Clink-arg=-lclang_rt.builtins-wasm32"
"-Clink-arg=--export=mark_decommit_pages",
"-Clink-arg=--export=mallinfo",
"-Clink-arg=--export=mchunkit_begin",
"-Clink-arg=--export=mchunkit_next",
"-Clink-arg=--export=get_pages_state",
]

[build]
target = "wasm32-wasi"
target = "wasm32-wasi"
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
profile = "default"
channel = "1.72.1"
channel = "1.79.0"
2 changes: 1 addition & 1 deletion scripts/run_docker_cmd.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

set image="ghcr.io/flybywiresim/dev-env@sha256:528f8e1ca9063b9346c7d4f684d7aadbcb58ca1fba2b1a3c2cdd9c820c4236f4"
set image="ghcr.io/flybywiresim/dev-env@sha256:aa36c0e4b8c66c2ec0195a104f8ae04a8ffbf45e8ddb6a8aca4f7237436bd876"

cd %~dp0

Expand Down
2 changes: 1 addition & 1 deletion scripts/run_docker_cmd.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

IMAGE="ghcr.io/flybywiresim/dev-env@sha256:528f8e1ca9063b9346c7d4f684d7aadbcb58ca1fba2b1a3c2cdd9c820c4236f4"
IMAGE="ghcr.io/flybywiresim/dev-env@sha256:aa36c0e4b8c66c2ec0195a104f8ae04a8ffbf45e8ddb6a8aca4f7237436bd876"

cd "$(dirname "$0")"

Expand Down
6 changes: 4 additions & 2 deletions src/test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ const promiseResults = new Map<bigint, [number, number]>()
const failedRequests: bigint[] = []

wasmInstance = new WebAssembly.Instance(wasmModule, {
wasi_snapshot_preview1: wasiSystem.wasiImport,
wasi_snapshot_preview1: Object.assign(wasiSystem.wasiImport, {
commit_pages: () => { }, // Empty implementation of this function as it is needed for the WASM module to properly load
}),
env: {
fsCommBusCall: (eventNamePointer: number, args: number) => {
const eventName = readString(eventNamePointer)
Expand Down Expand Up @@ -236,7 +238,7 @@ wasmInstance = new WebAssembly.Instance(wasmModule, {
return 3 // FS_NETWORK_HTTP_REQUEST_STATE_DATA_READY
}
return 2 // FS_NETWORK_HTTP_REQUEST_STATE_WAITING_FOR_DATA
},
}
},
}) as WasmInstance

Expand Down

0 comments on commit 0bd26e3

Please sign in to comment.