[llvm] [MC][WebAssembly] Fix importing tables with limits (PR #172992)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 22 08:37:45 PST 2025


================
@@ -1849,6 +1850,15 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
       HandleReloc(RelEntry);
     for (const WasmRelocationEntry &RelEntry : DataRelocations)
       HandleReloc(RelEntry);
+
+    // Update minimum size of `__indirect_function_table` table.
+    auto It = llvm::find_if(Imports, [](const wasm::WasmImport &I) {
+      return I.Field == "__indirect_function_table";
+    });
----------------
sbc100 wrote:

But if we could make the table size correct before we call `prepareImports` then I think this would not be need here because we set the size of imported table based on the symbol information on line 1405.

I guess the problem is that we call `prepareImports` early on before the table size I known?     I wonder if we could change the ordering ot make this possible.

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


More information about the llvm-commits mailing list