[PATCH] D42081: [WebAssembly] Symbol changes #2: Table relocs, LLD

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 11:30:04 PST 2018


sbc100 added inline comments.


================
Comment at: wasm/InputFiles.cpp:70
 uint32_t ObjFile::relocateTableIndex(uint32_t Original) const {
-  Symbol *Sym = TableSymbols[Original];
+  Symbol *Sym = FunctionSymbols[Original];
   uint32_t Index = Sym->hasTableIndex() ? Sym->getTableIndex() : 0;
----------------
Can this function now be removed?


================
Comment at: wasm/InputFiles.h:111
 private:
+  uint32_t getRelocatedAddress(uint32_t Index) const;
   uint32_t relocateTypeIndex(uint32_t Original) const;
----------------
perhaps call this relocateAddress, relocateVirtualAddress or relocateMemoryLocation or something similar to match the functions below?


================
Comment at: wasm/Writer.cpp:668
     DEBUG(dbgs() << "Table Indexes: " << File->getName() << "\n");
-    for (Symbol *Sym : File->getTableSymbols()) {
-      if (Sym->hasTableIndex() || !Sym->hasOutputIndex())
+    auto HandleRelocs = [&](ArrayRef<WasmRelocation> Relocations) {
+        for (const WasmRelocation& Reloc : Relocations) {
----------------
Maybe call this handleTableRelocs?


================
Comment at: wasm/Writer.cpp:682
+      if (Func->Discarded)
         continue;
+      HandleRelocs(Func->getRelocations());
----------------
If the lamda takes and InputChunk* then can this condition move there and we can just have:

```
for (InputFunction* Func : File->Functions)
  HandleRelocs(Func);
for (InputSegment* Seg : File->Segments)
  HandleRelocs(Seg);
```
  



Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42081





More information about the llvm-commits mailing list