mirror of
https://github.com/alibaba/higress.git
synced 2026-06-06 11:17:29 +08:00
update wasm go sdk to tinygo 0.28.1 (#462)
This commit is contained in:
@@ -1,14 +1,30 @@
|
||||
// Copyright The OWASP Coraza contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//go:build tinygo
|
||||
|
||||
package main
|
||||
|
||||
import _ "github.com/wasilibs/nottinygc"
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Compiled by nottinygc for delayed free but Envoy doesn't stub it yet,
|
||||
// luckily nottinygc doesn't actually call the function, so it's fine to
|
||||
// stub it out.
|
||||
// Some host functions that are not implemented by Envoy end up getting imported anyways
|
||||
// by code that gets compiled but not executed at runtime. Because we know they are not
|
||||
// executed, we can stub them out to allow functioning on Envoy. Note, these match the
|
||||
// names and signatures of wasi-libc, used by TinyGo, not WASI ABI. Review these exports when either
|
||||
// the minimum supported version of Envoy changes or the maximum version of TinyGo.
|
||||
|
||||
//export sched_yield
|
||||
func sched_yield() int32 {
|
||||
return 0
|
||||
// fdopendir is re-exported to avoid TinyGo 0.28's import of wasi_snapshot_preview1.fd_readdir.
|
||||
//
|
||||
//export fdopendir
|
||||
func fdopendir(fd int32) unsafe.Pointer {
|
||||
return nil
|
||||
}
|
||||
|
||||
// readdir is re-exported to avoid TinyGo 0.28's import of wasi_snapshot_preview1.fd_readdir.
|
||||
//
|
||||
//export readdir
|
||||
func readdir(unsafe.Pointer) unsafe.Pointer {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user