[PATCH] D42285: [WebAssembly] Allow non-zero table offset in input object

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 10:24:03 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL322976: [WebAssembly] Allow non-zero table offset in input object (authored by sbc, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D42285

Files:
  lld/trunk/wasm/InputFiles.cpp
  lld/trunk/wasm/Writer.cpp


Index: lld/trunk/wasm/InputFiles.cpp
===================================================================
--- lld/trunk/wasm/InputFiles.cpp
+++ lld/trunk/wasm/InputFiles.cpp
@@ -281,9 +281,9 @@
       fatal(getName() + ": unsupported element segment");
     if (Segment.TableIndex != 0)
       fatal(getName() + ": unsupported table index in elem segment");
-    if (Segment.Offset.Value.Int32 != 0)
-      fatal(getName() + ": unsupported element segment offset");
-    TableSymbols.reserve(Segment.Functions.size());
+    uint32_t Offset = Segment.Offset.Value.Int32;
+    TableSymbols.resize(Offset);
+    TableSymbols.reserve(Offset + Segment.Functions.size());
     for (uint64_t FunctionIndex : Segment.Functions)
       TableSymbols.push_back(FunctionSymbols[FunctionIndex]);
   }
Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -748,7 +748,7 @@
   for (ObjFile *File : Symtab->ObjectFiles) {
     DEBUG(dbgs() << "Table Indexes: " << File->getName() << "\n");
     for (Symbol *Sym : File->getTableSymbols()) {
-      if (Sym->hasTableIndex() || !Sym->hasOutputIndex())
+      if (!Sym || Sym->hasTableIndex() || !Sym->hasOutputIndex())
         continue;
       Sym->setTableIndex(TableIndex++);
       IndirectFunctions.emplace_back(Sym);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42285.130651.patch
Type: text/x-patch
Size: 1364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180119/6d5e6683/attachment.bin>


More information about the llvm-commits mailing list