diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp @@ -179,8 +179,12 @@ report_fatal_error("cannot use thread-local storage without bulk memory", false); + // XXX Emscripten: currently Emscripten does not support dynamic linking + // with threads. Therefore, if we have thread-local storage, only the + // local-exec model is possible. if (GA->getGlobal()->getThreadLocalMode() != - GlobalValue::LocalExecTLSModel) { + GlobalValue::LocalExecTLSModel && + !Subtarget->getTargetTriple().isOSEmscripten()) { report_fatal_error("only -ftls-model=local-exec is supported for now", false); }