diff --git a/src/runtime/arch_tinygowasm_malloc.go b/src/runtime/arch_tinygowasm_malloc.go index acbea9ab..239f7c73 100644 --- a/src/runtime/arch_tinygowasm_malloc.go +++ b/src/runtime/arch_tinygowasm_malloc.go @@ -1,4 +1,4 @@ -//go:build tinygo.wasm && !custommalloc +//go:build tinygo.wasm && !(custommalloc || wasm_unknown) package runtime diff --git a/src/runtime/runtime_tinygowasm_unknown.go b/src/runtime/runtime_tinygowasm_unknown.go index 08a9414f..39caa245 100644 --- a/src/runtime/runtime_tinygowasm_unknown.go +++ b/src/runtime/runtime_tinygowasm_unknown.go @@ -31,10 +31,9 @@ func abort() { //go:linkname syscall_Exit syscall.Exit func syscall_Exit(code int) { - //proc_exit(uint32(code)) } -// TinyGo does not yet support any form of parallelism on WebAssembly, so these +// There is not yet any support for any form of parallelism on WebAssembly, so these // can be left empty. //go:linkname procPin sync/atomic.runtime_procPin diff --git a/src/runtime/runtime_wasm_unknown.go b/src/runtime/runtime_wasm_unknown.go index c17ece25..5ba83211 100644 --- a/src/runtime/runtime_wasm_unknown.go +++ b/src/runtime/runtime_wasm_unknown.go @@ -2,9 +2,7 @@ package runtime -import ( - "unsafe" -) +import "unsafe" type timeUnit int64 @@ -21,10 +19,6 @@ func _start() { run() } -// Read the command line arguments from WASI. -// For example, they can be passed to a program with wasmtime like this: -// -// wasmtime run ./program.wasm arg1 arg2 func init() { __wasm_call_ctors() } @@ -39,7 +33,8 @@ func nanosecondsToTicks(ns int64) timeUnit { return timeUnit(ns) } -const timePrecisionNanoseconds = 1000 // TODO: how can we determine the appropriate `precision`? +// with the wasm32-unknown-unknown target there is no way to determine any `precision` +const timePrecisionNanoseconds = 1000 func sleepTicks(d timeUnit) { } diff --git a/targets/wasm-unknown.json b/targets/wasm-unknown.json index 3a96eb03..aefc6047 100644 --- a/targets/wasm-unknown.json +++ b/targets/wasm-unknown.json @@ -1,7 +1,7 @@ { "llvm-target": "wasm32-unknown-unknown", "cpu": "generic", - "features": "+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext", + "features": "+mutable-globals,+nontrapping-fptoint,+sign-ext", "build-tags": ["tinygo.wasm", "wasm_unknown"], "goos": "linux", "goarch": "arm", @@ -10,13 +10,14 @@ "scheduler": "none", "default-stack-size": 4096, "cflags": [ - "-mbulk-memory", + "-mno-bulk-memory", "-mnontrapping-fptoint", "-msign-ext" ], "ldflags": [ "--no-demangle", - "--no-entry" + "--no-entry", + "--import-memory" ], "extra-files": [ "src/runtime/asm_tinygowasm.S"