[lld] wasm-ld: Implement function pointer alignment (PR #105532)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 09:40:10 PDT 2025


================
@@ -604,9 +611,11 @@ void ElemSection::writeBody() {
   writeUleb128(os, indirectFunctions.size(), "elem count");
   uint32_t tableIndex = ctx.arg.tableBase;
   for (const FunctionSymbol *sym : indirectFunctions) {
-    assert(sym->getTableIndex() == tableIndex);
+    if (sym != nullptr) {
+      assert(sym->getTableIndex() == tableIndex);
+    }
----------------
sbc100 wrote:

Can you instead write this one line as  `assert(!sym || sym->getTableIndex() == tableIndex))`

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


More information about the llvm-commits mailing list