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

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 21 18:39:33 PST 2025


================
@@ -1843,6 +1844,15 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
         TableElems.push_back(FunctionIndex);
         registerFunctionType(*Base);
       }
+
+      // Update minimum size of `__indirect_function_table` table.
+      auto It = llvm::find_if(Imports, [](const wasm::WasmImport &I) {
+        return I.Field == "__indirect_function_table";
+      });
+
+      if (It != Imports.end()) {
+        It->Table.Limits.Minimum = TableElems.size();
+      }
----------------
daxpedda wrote:

Ah, my bad ... I remember double-checking this actually :/

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


More information about the llvm-commits mailing list