[PATCH] D133110: lld: Include name of output file in "failed to write output" diag

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 07:08:09 PDT 2022


thakis created this revision.
thakis added a reviewer: MaskRay.
Herald added subscribers: pmatos, asb, StephenFan, arichardson, sbc100, emaste.
Herald added a reviewer: ributzka.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
thakis requested review of this revision.
Herald added a subscriber: aheejin.

https://reviews.llvm.org/D133110

Files:
  lld/COFF/Writer.cpp
  lld/ELF/Writer.cpp
  lld/MachO/Writer.cpp
  lld/wasm/Writer.cpp


Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -1661,7 +1661,8 @@
     return;
 
   if (Error e = buffer->commit())
-    fatal("failed to write the output file: " + toString(std::move(e)));
+    fatal("failed to write output '" + buffer->getPath() +
+          "': " + toString(std::move(e)));
 }
 
 // Open a result file.
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -1118,7 +1118,8 @@
   writeCodeSignature();
 
   if (auto e = buffer->commit())
-    error("failed to write to the output file: " + toString(std::move(e)));
+    fatal("failed to write output '" + buffer->getPath() +
+          "': " + toString(std::move(e)));
 }
 
 template <class LP> void Writer::run() {
Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -587,7 +587,8 @@
       return;
 
     if (auto e = buffer->commit())
-      error("failed to write to the output file: " + toString(std::move(e)));
+      fatal("failed to write output '" + buffer->getPath() +
+            "': " + toString(std::move(e)));
   }
 }
 
Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -648,7 +648,8 @@
 
   ScopedTimer t2(ctx.outputCommitTimer);
   if (auto e = buffer->commit())
-    fatal("failed to write the output file: " + toString(std::move(e)));
+    fatal("failed to write output '" + buffer->getPath() +
+          "': " + toString(std::move(e)));
 }
 
 static StringRef getOutputSectionName(StringRef name) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133110.457260.patch
Type: text/x-patch
Size: 1770 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220901/af471ca8/attachment.bin>


More information about the llvm-commits mailing list