[PATCH] D89274: [WebAssembly] Use the new crt1-command.o if present.

Dan Gohman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 14:57:15 PDT 2020


sunfish created this revision.
sunfish added a reviewer: sbc100.
Herald added subscribers: cfe-commits, ecnelises, jgravelle-google, dschuff.
Herald added a project: clang.
sunfish requested review of this revision.
Herald added a subscriber: aheejin.

If crt1-command.o exists in the sysroot, the libc has new-style command
support, so use it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89274

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
@@ -77,6 +77,12 @@
 
   const char *Crt1 = "crt1.o";
   const char *Entry = NULL;
+
+  // If crt1-command.o exists, it supports new-style commands, so use it.
+  // Otherwise, use the old crt1.o.
+  if (ToolChain.GetFilePath("crt1-command.o") != "crt1-command.o")
+    Crt1 = "crt1-command.o";
+
   if (const Arg *A = Args.getLastArg(options::OPT_mexec_model_EQ)) {
     StringRef CM = A->getValue();
     if (CM == "command") {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89274.297698.patch
Type: text/x-patch
Size: 644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201012/8f5d26a2/attachment.bin>


More information about the cfe-commits mailing list