[PATCH] D47162: [WebAssembly] Initial support for LTO

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 09:14:46 PDT 2018


ruiu added inline comments.


================
Comment at: wasm/Driver.cpp:279
+// Force Sym to be entered in the output. Used for -u or equivalent.
+static Symbol *handleUndefined(StringRef Name) {
+  Symbol *S = Symtab->addUndefinedFunction(Name, 0, nullptr, nullptr);
----------------
It feels like `handle` prefix implies that it's a side-effect-only function, though this function returns a new object. Perhaps addUndefined is a better name.


================
Comment at: wasm/Driver.cpp:291
   WasmOptTable Parser;
+  Config->ProgName = ArgsArr[0];
   opt::InputArgList Args = Parser.parse(ArgsArr.slice(1));
----------------
We do this not in Driver::main() but in elf::link() in the ELF linker.


================
Comment at: wasm/InputFiles.cpp:392
+  if (T.getArch() != Triple::wasm32) {
+    fatal(toString(MB.getBufferIdentifier()) + ": machine type must be wasm32");
+    return;
----------------
ruiu wrote:
> `fatal` is to report corrupted files. Since this case is to report a miseuse of the command, you should use `error`.
Please fix.


================
Comment at: wasm/LTO.h:51
+  std::unique_ptr<llvm::lto::LTO> LTOObj;
+  std::vector<SmallString<0>> Buff;
+  std::vector<std::unique_ptr<MemoryBuffer>> Files;
----------------
Buff -> Buf for consistency with ELF.


================
Comment at: wasm/SymbolTable.cpp:201
+Symbol *SymbolTable::addBitcode(StringRef Name, InputFile *File) {
+  DEBUG(dbgs() << "addBitcode: " << Name << "\n");
+  return nullptr;
----------------
Why is this function empty?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47162





More information about the llvm-commits mailing list