[PATCH] D62153: [WebAssembly] Relax signature checking for undefined functions that are not called directly

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 09:59:12 PDT 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.

When function signatures don't match and the undefined function is not
called directly (i.e. only has its address taken) we don't issue a
warning or create a runtime thunk for the undefined function.

Instead in this case we simply use the defined version of the function.
This is possible since checking signatures of dynamic calls happens
at runtime so any invalid usage will still result in a runtime error.

This is needed to allow C++ programs to link without generating
warnings.  Its not uncommon in C++ for vtables to be populated by
function address whee the signature of the function is not known in the
compilation unit.  In this case clang delcares the method as void(void)
and relies on the vtable caller casting the data back to the correct
signature.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=40412


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62153

Files:
  lld/test/wasm/signature-mismatch-unknown.ll
  lld/wasm/InputFiles.cpp
  lld/wasm/InputFiles.h
  lld/wasm/SymbolTable.cpp
  lld/wasm/SymbolTable.h
  lld/wasm/Symbols.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62153.200321.patch
Type: text/x-patch
Size: 8614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190520/8ef93698/attachment.bin>


More information about the llvm-commits mailing list