[PATCH] D45118: Linking debug (DWARF) sections from the WebAssembly object files

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 26 13:18:27 PDT 2018


sbc100 added inline comments.


================
Comment at: wasm/InputFiles.cpp:96
+        WasmObj->functions()[Sym.Info.ElementIndex -
+                             WasmObj->getNumImportedFunctions()];
+    size_t FunctionCodeOffset = getFunctionCodeOffset(Function.Body);
----------------
Can you use Sym->Function->getFunctionBody() here like you do below?


================
Comment at: wasm/InputFiles.cpp:101
+  case R_WEBASSEMBLY_SECTION_OFFSET_I32:
+    return Reloc.Addend; // TODO absolute to wasm file start?
   case R_WEBASSEMBLY_TYPE_INDEX_LEB:
----------------
Can you remove this TODO?   Shouldn't the value in the file always be section-relative?


================
Comment at: wasm/InputFiles.cpp:327
+  case WASM_SYMBOL_TYPE_SECTION:
+    return Symtab->addUndefinedSection(Name, Flags, this);
   }
----------------
I don't think undefined section symbols should be possible. 

In fact, so we even want defined section symbols in the symbol table?   They don't have unique names after all.  The way ELF handles this is that all section symbols have local binding so should never get added to symboltable.


================
Comment at: wasm/SymbolTable.h:42
 public:
+  using SyntheticSection = llvm::DenseMap<InputFile *, InputSection *>;
+
----------------
We already type with this name in OutputSections.h.




================
Comment at: wasm/Symbols.h:199
+  }
+};
+
----------------
I don't think we can have undefined section symbols, so maybe we only need one type here?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45118





More information about the llvm-commits mailing list