[PATCH] D156205: wasm: link crt1 even in case of -shared

YAMAMOTO Takashi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 22:26:15 PDT 2023


yamt created this revision.
Herald added subscribers: pmatos, asb, sunfish, jgravelle-google, sbc100, dschuff.
Herald added a project: All.
yamt requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, aheejin.
Herald added a project: clang.

This allows -mexec-model=reactor -shared produces a library module
with _initialize entrypoint, which is preferrable over __wasm_call_ctors.

This partially reverts https://reviews.llvm.org/D153293

Discussion: https://github.com/dicej/component-linking-demo/issues/3


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156205

Files:
  clang/lib/Driver/ToolChains/WebAssembly.cpp


Index: clang/lib/Driver/ToolChains/WebAssembly.cpp
===================================================================
--- clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -101,7 +101,7 @@
           << CM << A->getOption().getName();
     }
   }
-  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, options::OPT_shared))
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles))
     CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(Crt1)));
   if (Entry) {
     CmdArgs.push_back(Args.MakeArgString("--entry"));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156205.543821.patch
Type: text/x-patch
Size: 600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230725/956ff66b/attachment.bin>


More information about the cfe-commits mailing list