[PATCH] D63694: [lld/WebAssembly] Slightly nicer error message for malformed input files

Keno Fischer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 15:21:27 PDT 2019


loladiro created this revision.
loladiro added a reviewer: sbc100.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
Herald added a project: LLVM.

Before:

  wasm-ld: error: Relocations not in offset order

After

  wasm-ld: error: While processing `libjulia.so`: Relocations not in offset order

At least this way you get to find out which input file is malformed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63694

Files:
  lld/wasm/InputFiles.cpp


Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -52,7 +52,8 @@
                                        StringRef ArchiveName) {
   file_magic Magic = identify_magic(MB.getBuffer());
   if (Magic == file_magic::wasm_object) {
-    std::unique_ptr<Binary> Bin = check(createBinary(MB));
+    std::unique_ptr<Binary> Bin = CHECK(createBinary(MB),
+      "While processing `" + MB.getBufferIdentifier() + "`");
     auto *Obj = cast<WasmObjectFile>(Bin.get());
     if (Obj->isSharedObject())
       return make<SharedFile>(MB);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63694.206141.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190623/ac4ded43/attachment.bin>


More information about the llvm-commits mailing list