@@ -268,6 +268,11 @@ lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a:
268
268
@if [ ! -e lib/wasi-libc/Makefile ]; then echo " Submodules have not been downloaded. Please download them using:\n git submodule update --init" ; exit 1; fi
269
269
cd lib/wasi-libc && $(MAKE ) -j4 EXTRA_CFLAGS=" -O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC=" $( CLANG) " AR=$(LLVM_AR ) NM=$(LLVM_NM )
270
270
271
+ # Generate WASI syscall bindings
272
+ .PHONY : wasi-syscall
273
+ wasi-syscall :
274
+ wit-bindgen-go generate -o ./src/internal -p internal --versioned ./lib/wasi-cli/wit
275
+
271
276
# Check for Node.js used during WASM tests.
272
277
NODEJS_VERSION := $(word 1,$(subst ., ,$(shell node -v | cut -c 2-) ) )
273
278
MIN_NODEJS_VERSION =18
@@ -430,15 +435,36 @@ tinygo-test-wasi:
430
435
$(TINYGO ) test -target wasip1 $(TEST_PACKAGES_FAST ) $(TEST_PACKAGES_SLOW ) ./tests/runtime_wasi
431
436
tinygo-test-wasip1 :
432
437
GOOS=wasip1 GOARCH=wasm $(TINYGO ) test $(TEST_PACKAGES_FAST ) $(TEST_PACKAGES_SLOW ) ./tests/runtime_wasi
433
- tinygo-test-wasi-fast :
434
- $(TINYGO ) test -target wasip1 $(TEST_PACKAGES_FAST ) ./tests/runtime_wasi
435
438
tinygo-test-wasip1-fast :
436
- GOOS=wasip1 GOARCH=wasm $(TINYGO ) test $(TEST_PACKAGES_FAST ) ./tests/runtime_wasi
437
- tinygo-bench-wasi :
439
+ $(TINYGO ) test -target=wasip1 $(TEST_PACKAGES_FAST ) ./tests/runtime_wasi
440
+
441
+ tinygo-test-wasip2-slow :
442
+ $(TINYGO ) test -target=wasip2 $(TEST_PACKAGES_SLOW )
443
+ tinygo-test-wasip2-fast :
444
+ $(TINYGO ) test -target=wasip2 $(TEST_PACKAGES_FAST ) ./tests/runtime_wasi
445
+
446
+ tinygo-test-wasip2-sum-slow :
447
+ TINYGO=$(TINYGO ) \
448
+ TARGET=wasip2 \
449
+ TESTOPTS=" -x -work" \
450
+ PACKAGES=" $( TEST_PACKAGES_SLOW) " \
451
+ gotestsum --raw-command -- ./tools/tgtestjson.sh
452
+ tinygo-test-wasip2-sum-fast :
453
+ TINYGO=$(TINYGO ) \
454
+ TARGET=wasip2 \
455
+ TESTOPTS=" -x -work" \
456
+ PACKAGES=" $( TEST_PACKAGES_FAST) " \
457
+ gotestsum --raw-command -- ./tools/tgtestjson.sh
458
+ tinygo-bench-wasip1 :
438
459
$(TINYGO ) test -target wasip1 -bench . $(TEST_PACKAGES_FAST ) $(TEST_PACKAGES_SLOW )
439
- tinygo-bench-wasi -fast :
460
+ tinygo-bench-wasip1 -fast :
440
461
$(TINYGO ) test -target wasip1 -bench . $(TEST_PACKAGES_FAST )
441
462
463
+ tinygo-bench-wasip2 :
464
+ $(TINYGO ) test -target wasip2 -bench . $(TEST_PACKAGES_FAST ) $(TEST_PACKAGES_SLOW )
465
+ tinygo-bench-wasip2-fast :
466
+ $(TINYGO ) test -target wasip2 -bench . $(TEST_PACKAGES_FAST )
467
+
442
468
# Test external packages in a large corpus.
443
469
test-corpus :
444
470
CGO_CPPFLAGS=" $( CGO_CPPFLAGS) " CGO_CXXFLAGS=" $( CGO_CXXFLAGS) " CGO_LDFLAGS=" $( CGO_LDFLAGS) " $(GO ) test $(GOTESTFLAGS ) -timeout=1h -buildmode exe -tags byollvm -run TestCorpus . -corpus=testdata/corpus.yaml
@@ -832,6 +858,7 @@ build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN
832
858
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-bottom-half/headers
833
859
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-top-half/musl/arch
834
860
@mkdir -p build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
861
+ @mkdir -p build/release/tinygo/lib/wasi-cli/
835
862
@mkdir -p build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0
836
863
@mkdir -p build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0plus
837
864
@mkdir -p build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4
@@ -891,6 +918,7 @@ endif
891
918
@cp -rp lib/wasi-libc/libc-top-half/musl/src/string build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
892
919
@cp -rp lib/wasi-libc/libc-top-half/musl/include build/release/tinygo/lib/wasi-libc/libc-top-half/musl
893
920
@cp -rp lib/wasi-libc/sysroot build/release/tinygo/lib/wasi-libc/sysroot
921
+ @cp -rp lib/wasi-cli/wit build/release/tinygo/lib/wasi-cli/wit
894
922
@cp -rp llvm-project/compiler-rt/lib/builtins build/release/tinygo/lib/compiler-rt-builtins
895
923
@cp -rp llvm-project/compiler-rt/LICENSE.TXT build/release/tinygo/lib/compiler-rt-builtins
896
924
@cp -rp src build/release/tinygo/src
0 commit comments