[PATCH] D44028: [WebAssembly] Handle weak undefined globals and functions

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 15:04:27 PST 2018

sbc100 added inline comments.

Comment at: wasm/MarkLive.cpp:84
+          cast<FunctionSymbol>(Sym)->hasTableIndex())
+        continue;
+      Enqueue(Sym);
ncw wrote:
> sbc100 wrote:
> > What would be the harm in marking them as live here?
> If they were marked live, they'd be included in the final binary even if never called. Just harmless bloat. Some of our existing tests do this - only ever call a weak undefined indirectly via its address. Since the address evaluates to zero, the stub is as dead as can be and seems a reasonable candidate for GC.
Hmm  I think I see.. since the table index is 0, it can have its address taken, without needing the function body to be including.   This is pretty obscure.   Maybe a clearer comment.. its not the fact that it has an index already, but specifically that the index is 0 that allows us to do this, right?  Otherwise the address taking would necessitate the liveness of the body, right?

  rLLD LLVM Linker


More information about the llvm-commits mailing list