[PATCH] D40559: Run Wasm entrypoint on load

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 10:10:39 PST 2017


dschuff added inline comments.


================
Comment at: wasm/Driver.cpp:328
+    if (!Config->Entry.empty())
+      addSyntheticUndefinedFunction(Config->Entry);
 
----------------
ncw wrote:
> sbc100 wrote:
> > Don't we always want some kind of entry point for non-relocatable binaries.  Without it it will be hard to gc unused functions.   (I suppose we could use the '-u' flag to pin the function we want kept instead?)
> I think it makes sense to allow having no entry point. In this case, the only exports will be the (non-hidden) functions defined in the `.o` files, plus the (non-hidden) functions defined in objects that were loaded from any `.a` files.
> 
> It would be nice for "completeness" to add a `-u` commandline argument, to allow pulling in symbols from `.a` files that come from translation units we're not otherwise touching.
> 
> I'm expecting that 99% of people with a Wasm module will be wanting to export an API consisting of several functions, so the `--entry` argument was never really going to be enough to be useful in the general case for selecting which functions should be exported.
> 
> I'll add `-u` support to wasm-lld while I'm at it!
> 
+1. For Emscripten, for now we will probably just use the "no entry" case and call `main` explicitly.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D40559





More information about the llvm-commits mailing list