#5796·tinygo

runtime.wasiOnIdle missing — async component glue fails to link (undefined symbol: runtime.wasiOnIdle)

Author: gqf2008Created Sep 30, 2026Updated Sep 30, 2026

The async component glue generated by wit-bindgen go 0.62 relies on a runtime hook TinyGo does not provide, so the final link fails:

wasm-ld: error: main.lto..o: undefined symbol: runtime.wasiOnIdle

Where it comes from: go.bytecodealliance.org/pkg (vendored v0.2.3) has, in its async support,

go
//go:linkname wasiOnIdle runtime.wasiOnIdle

and that package's own comment says it “is not part of upstream Go and requires this patch (dicej/go@40fc123)”. TinyGo 0.42.0's runtime has no such symbol — src/runtime/ exposes sleepTicks / waitForEvents but nothing that means “the scheduler has nothing to do, hand control back to the host”.

Why a stub is not a workaround: the semantics are “notify the host when the scheduler is idle”. Making wasiOnIdle an empty function makes the generated witAsync.Run block forever on <-state.channel instead of yielding, so the component hangs rather than runs.

Environment: TinyGo 0.42.0 + Go 1.25.7 + wit-bindgen go 0.62 + Binaryen 133 + preview1 reactor adapter 48.0.3; target route is the core module + embed + wasm-tools component embed/new with the reactor adapter (TinyGo's -target=wasip2 does not lift custom exports, and scheduler=none is refused because go initAll() starts a goroutine). Compilation of the generated glue succeeds; only the link fails.

Impact: a TinyGo guest cannot export async functions at all; we are blocked on the Go cell of our language matrix. Request: implement the runtime.wasiOnIdle hook (or expose an equivalent) so the bytecodealliance Go async glue can link.

Reported from https://github.com/gqf2008/tau (contract tau:[email protected], async exports).