Just another little update on this issue. I created a small example which doesn't call threads from Rust; instead it links to a C library which does create a thread, and prints out some status to the console. This works as a native x86_64 program on Linux, but has the same wasm-ld
link errors when trying with wasm32-unknown-emscripten
(not too surprising):
relocation R_WASM_MEMORY_ADDR_TLS_SLEB cannot be used against non-TLS symbol `std::sys_common::thread_info::THREAD_INFO::__getit::STATE::h23a43961a5b1f8ea
...complaining about various symbols not being part of thread local storage. Which confirms that the error doesn't just depend on starting threads in the Rust side of things (but of course needs to link against thread safe libraries). This example only starts and uses threads on the C side.
There is also some interesting information on this comment about the same link errors in the Emscripten issue tracker.