[PATCH] D44028: [WebAssembly] Handle weak undefined functions with a synthetic stub

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 08:46:05 PST 2018


ruiu added a comment.

I have a few questions because I don't know much about this wasm feature...

1. Let's say `WeakFunc` is a weak function symbol that is not defined at link time. Then `if (WeakFunc)` should be evaluated to false... but how does it actually be translated to wasm instructions? Is it compiled to a indirect call with function index 0?
2. I'm not 100% sure why we need to provide a dummy function for an unresolved weak undefined symbols. Is it for catching an error when a program accidentally calls an undefined weak symbol at runtime? Then, I wonder if we want a function that prints out a better error message (e.g. "unresolved weak function `foo` is invoked`"), instead of just killing itself with a UB instruction.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44028





More information about the llvm-commits mailing list