Index: wasm/LTO.cpp =================================================================== --- wasm/LTO.cpp +++ wasm/LTO.cpp @@ -47,8 +47,12 @@ C.Options.FunctionSections = true; C.Options.DataSections = true; - // Wasm currently only supports ThreadModel::Single - C.Options.ThreadModel = ThreadModel::Single; + // When shared memory is disabled wasm doesn't support atomics operations. + // Setting the thead model based on the SharedMemory option seems like + // reasonable default. Idealy the bitcode metadata would set this on + // a per function basis instead. + C.Options.ThreadModel = + Config->SharedMemory ? ThreadModel::POSIX : ThreadModel::Single; C.DisableVerify = Config->DisableVerify; C.DiagHandler = diagnosticHandler;