[PATCH] D90428: [WebAssembly] Improved LLD error messages in case of mixed wasm32/wasm64 object files

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 14:24:27 PDT 2020


sbc100 added inline comments.


================
Comment at: lld/wasm/InputChunks.cpp:63
     unsigned bytesRead = 0;
+    unsigned padding = 0;
     auto offset = rel.Offset - getInputSectionOffset();
----------------
Maybe just initialize to 5 and override for the 64-bit cases.

Also maybe a better name, since this is not that amount of padded by the overall width.  Howabout maxLEBWidth?  Or paddedLEBWidth?


================
Comment at: lld/wasm/InputFiles.cpp:51
+    fatal(toString(file) +
+          ": wasm32 object file can\'t be linked in wasm64 mode");
+  }
----------------
No need to escape single quote is there?

Can we get tests for these new error cases?


================
Comment at: lld/wasm/InputFiles.cpp:600
   }
-  bool is64 = t.getArch() == Triple::wasm64;
-  if (config->is64.hasValue() && *config->is64 != is64) {
-    error(toString(this) + ": machine type for all bitcode files must match");
-    return;
-  }
-  config->is64 = is64;
+  checkArch(t.getArch(), this);
   std::vector<bool> keptComdats;
----------------
Passing `this` at each callside makes me think this should be a method, no?


================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:502
+  if (Type != wasm::R_WASM_TYPE_INDEX_LEB /*&&
+      Type != wasm::R_WASM_MEMORY_ADDR_I64*/) {
     if (SymA->getName().empty())
----------------
Revert this ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90428/new/

https://reviews.llvm.org/D90428



More information about the llvm-commits mailing list