[PATCH] D42511: [WebAssembly] Add support for --gc-sections

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 16:54:00 PST 2018


ncw added a comment.

In https://reviews.llvm.org/D42511#992690, @ruiu wrote:

> I'm not sure if I understand the last sentence correctly. If you need to scan relocations to garbage-collect types, that's what we do to other things like chunks in this file, so it's not special, is it?


You're right it's not very special, it's just surprising (to me). My initial expectation was "surely the only types that can be referenced are ones that actually exist in the Wasm file", so it should be easy to construct the types list just by examining function imports+definitions, without needing the type-pruning code to care about relocations. It seems sneaky and surprising to me that you can't just do that. It definitely needs a test for the "sneaky" case of calling a null pointer with a type that's nowhere else used.

Plus, types aren't an input chunk so it's not going to fit into this logic directly. In fact the implementation doesn't need to be put here at all, and will presumably actually live somewhere in Writer, well away from anything to do with GC here.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42511





More information about the llvm-commits mailing list