aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/runtime_wasm.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/runtime_wasm.go')
-rw-r--r--src/runtime/runtime_wasm.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/runtime_wasm.go b/src/runtime/runtime_wasm.go
index f2acf9768..1146f5781 100644
--- a/src/runtime/runtime_wasm.go
+++ b/src/runtime/runtime_wasm.go
@@ -16,6 +16,12 @@ type __wasi_iovec_t struct {
//export fd_write
func fd_write(id uint32, iovs *__wasi_iovec_t, iovs_len uint, nwritten *uint) (errno uint)
+// See:
+// https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#-proc_exitrval-exitcode
+//go:wasm-module wasi_snapshot_preview1
+//export proc_exit
+func proc_exit(exitcode uint32)
+
func postinit() {}
const (
@@ -49,6 +55,11 @@ func abort() {
trap()
}
+//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
// can be left empty.