[PATCH] D90948: [WebAssembly] call_indirect issues table number relocs

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 11:46:27 PST 2021


tlively added a comment.

In D90948#2538597 <https://reviews.llvm.org/D90948#2538597>, @wingo wrote:

> In D90948#2533714 <https://reviews.llvm.org/D90948#2533714>, @wingo wrote:
>
>>> - All feature detection happens in codegen, not in object writing.
>>
>> Yes, for `call_indirect`.   But when we emit a function pointer at the MC layer -- either in data or in code -- we need that to cause the function table to be present.  For function pointers in code, i think we can find the feature set just fine, so that for reftypes we cause a symtab entry to be emitted for the function table.  But for function pointers in data I don't know a good way to do feature detection; do you have any ideas here?
>
> Gentle ping regarding this point -- this is why I was mucking with features in the writer.  I plan on having another look in lowering but if you have other ideas they are welcome.

Would it be possible to do this feature detection and addition of a table in WebAssemblyAsmPrinter.cpp, which is the transition from the MachineInstr layer to the MC layer? This is the last point where the original LLVM `Module` is still available, so in the worst case you could traverse the `Module`'s global data to find function pointers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90948



More information about the llvm-commits mailing list