Skip to content

checkClosure function signature mismatch in rts debug way on wasm32

When linking with -debug way of rts on wasm32, there is a linker warning:

wasm-ld: warning: function signature mismatch: checkClosure
>>> defined as (i32) -> void in /workspace/ghc/_build/stage1/lib/../lib/wasm32-wasi-ghc-9.5.20221214/rts-1.0.2/libHSrts-1.0.2_debug_p.a(ContinuationOps.debug_p_o)
>>> defined as (i32) -> i32 in /workspace/ghc/_build/stage1/lib/../lib/wasm32-wasi-ghc-9.5.20221214/rts-1.0.2/libHSrts-1.0.2_debug_p.a(Sanity.debug_p_o)

It's due to how ContinuationOps.cmm calls checkClosure. GHC infers the C function signature to have no return value, which is actually not the case at its definition site. Fixing it is pretty straightforward, one needs to add an _unused return value to the checkClosure call site, there's an example in Apply.cmm already.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information