[PATCH] D62922: [WebAssembly] Implement "Reactor" mode

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 15:40:58 PDT 2019


sbc100 added a comment.

Add a test case to `clang/test/Driver/wasm-toolchain.c`?



================
Comment at: clang/lib/Driver/ToolChains/WebAssembly.cpp:71
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+    const char *CrtO = "crt1.o";
+    const char *Entry = NULL;
----------------
Maybe call this `Crt1` so it doesn't looks so much like crtZero?


================
Comment at: clang/lib/Driver/ToolChains/WebAssembly.cpp:75
+      CrtO = llvm::StringSwitch<const char *>(A->getValue())
+                 .Case("reactor", "reactor-crt1.o")
+                 .Default(CrtO);
----------------
I have a slight preference for `crt1-foo.o`  over `foo-crt1.o`.    But I've tell where that preference comes from :)   


================
Comment at: clang/lib/Driver/ToolChains/WebAssembly.cpp:79
+                 .Case("reactor", "__wasi_unstable_reactor_start")
+                 .Default(CrtO);
+    }
----------------
Shouldn't this be `nullptr`?

Also, maybe move the `if Entry` block inside this condition so this line can declare entry avoid the extra declaration above?


================
Comment at: clang/lib/Driver/ToolChains/WebAssembly.cpp:85
+      CmdArgs.push_back(Args.MakeArgString(Entry));
+    }
+  }
----------------
I assume that all he users `-Wl` args come after.. so its still possible to set `--entry` on the command line?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62922/new/

https://reviews.llvm.org/D62922





More information about the llvm-commits mailing list