[PATCH] D57800: [WebAssembly] LTO: Set POSIX thread model when linking with -shared-memoey

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 17:48:47 PST 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, jfb, dexonsmith, steven_wu, sunfish, aheejin, jgravelle-google, inglorion, mehdi_amini, dschuff.
Herald added a project: LLVM.

This allows LTO to use atomics during codegen.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D57800

Files:
  wasm/LTO.cpp


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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57800.185458.patch
Type: text/x-patch
Size: 762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190206/c52d5e16/attachment.bin>


More information about the llvm-commits mailing list