[PATCH] D97923: [WebAssembly][yaml2obj][obj2yaml] Elem sections for nonzero tables

Andy Wingo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 02:38:36 PST 2021


wingo added inline comments.


================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:919
+  assert(WasmIndices.count(IndirectFunctionTable));
+  uint32_t TableNumber = WasmIndices.find(IndirectFunctionTable)->second;
+  uint32_t Flags = 0;
----------------
sbc100 wrote:
> It looks like we pass IndirectFunctionTable just to get the table nunber.
> 
> Would it make sense to instead change the signature of this functions to:
> 
> ```void WasmObjectWriter::writeElemSection(uint32_t TableNumber, ArrayRef<uint32_t> TableElems)```
> 
> And then it can be re-used later once we support different tables?   Or maybe that be part of the followup?  
> 
> lgtm which ever way you think makes sense.
Yeah that's right.  Would work fine to pass a table number, only except that if TableElems is empty, it could be that there's no function table symbol.  Once we start having different / other tables, we may want to split things; there may be multiple segments against different tables, for example.  If OK with you, will reserve any needed refactors for a followup.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97923



More information about the llvm-commits mailing list