[PATCH] D57909: [WebAssembly] Don't generate invalid modules when function signatures mismatch

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 16:53:25 PST 2019


sbc100 added inline comments.


================
Comment at: wasm/Options.td:94
 
+def signature_check_strict : F<"signature-check-strict">,
+                             HelpText<"Error on function signature mismatch">;
----------------
ruiu wrote:
> Remove a space before `:`. Indent with two spaces.
Ha.. I hit my clang format button to get this :)


================
Comment at: wasm/SymbolTable.cpp:571-572
+
+// Remove any variant symbols that were created due to function signature
+// mismatches.
+void SymbolTable::handleSymbolVariants() {
----------------
ruiu wrote:
> It looks like you are trying to reduce the number of stub functions, by generating only one stub for each function type. But is this necessary? Given that no production code will contain a stub, no one cares if a binary with type mismatch contains many duplicated stubs?
Yes, I create one stub for each variant of each symbol by encoding the signature into a string and appending it to the symbol name.

Are you suggesting that createFunctionVariant not even use the symbol table at all and just unconditionally create a new Symbol outside the symbol table?  I guess it might work, but I'm not sure how much simpler it would make the code.

Finally I'm not sure this won't end up happening somewhat in production code, especially if we implement the more useful stubs that coerce rather than trap.



Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D57909





More information about the llvm-commits mailing list