[llvm] [WebAssembly] Define `__funcref_call_table` in generated asm and objects (PR #180900)

Demetrius Kanios via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 10:26:08 PST 2026


QuantumSegfault wrote:

> It looks like WebAssembly::getOrCreateFuncrefCallTableSymbol is just defining the table as weak on creation rather than ever leaving it undefined.

Well, it is marking it as weak, but that doesn't define it. It's still undefined (hence the error that "undefined symbols can't be weak" when trying to emit object files). 

--------

Not sure exactly what you mean about treating it the same as the other? When CallIndirectOverlong is enabled, call_indirect takes a table argument, so the reference to the `__funcref_call_table` would insert a relocation already.

--------

The problem is right now we are creating the `__funcref_call_table`, but never defining it. The linker synthesizes the `__indirect_function_table` normally (and objects might emit tentative versions as well???). But it does not do this for `__funcref_call_table`. It seems the intention was to mark it weak, and just have each module define an each module define an identical empty table (since there's otherwise nothing special about it; just needs to be an empty one element funcref table). But it still wasn't ever "defined", so then it being weak caused errors.

https://github.com/llvm/llvm-project/pull/180900


More information about the llvm-commits mailing list