Skip to content

build : enable atomics for wasm-emscripten

Mehdi Sabwat requested to merge (removed):wasm-thread into master

When targetting wasm32-unknown-emscripten, we need to have the -pthread option during compilation for all the objects that use atomic instructions.

When -pthread option is used on a object that has atomic instructions, a section is added to the binary notifying the linker that it is safe to use shared linear memory because atomic instructions were not stripped (default behavior if the option is not set).

cf. https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md#target-features-section

Before this patch, lib.c and thread_task.c were using atomic instructions but since -pthread was not passed during compilation a section was added to the binary, disallowing shared linear memory and preventing linking dav1d with a multi threaded wasm application.

Merge request reports