[PATCH] D70500: [WebAssembly] Enable use of wasm-opt and LTO-enabled system libraries

Derek Schuff via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 12:56:33 PST 2019


dschuff added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/WebAssembly.cpp:96
+  if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
+    if (const char *WasmOptPath = getenv("WASM_OPT")) {
+      StringRef OOpt = "s";
----------------
sunfish wrote:
> dschuff wrote:
> > What would you think about adding a way to pass arguments through to wasm-opt on the command line, like we have for the linker, assembler, etc? Something like `-Wo,-O2` (or `-Ww` or whatever; analogous to `-Wl` and `-Wa`). That seems nicer than an env var, although it doesn't solve the problem of controlling whether to run the optimizer in the first place.
> My guess here is that we don't need clang to have an option for passing additional flags -- if people want to do extra special things with wasm-opt on clang's output they can just run wasm-opt directly themselves. Does that sound reasonable?
Maybe. But I still don't like the use of an env var for this kind of behavior-effecting (i.e. non-debugging) use case.  It's hard enough to get reproducible and hermetic build behavior as it is, I definitely wouldn't want to worry about the environment affecting the output in addition to all the random flags, included files, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70500





More information about the cfe-commits mailing list