We've seen certain situations where in LTO builds wasm-ld will crash during Writer::createCallCtorsFunction because one of the init function in the generted LTO object file ( __cxx_global_var_init.1) in undefined and does not get assigned a function index (so crashes in sym->getFunctionIndex()).
I'm still working on reducing the repro case as more.
This seems to have started with https://reviews.llvm.org/D135427, which I guess makes sense since that change explicitly calls out __cxx_global_var_init as being discarded.