[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
Wed Sep 14 11:58:12 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcd7ffa2e52ce: lld: Include name of output file in "failed to write output" diag (authored by thakis).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D133110?vs=457298&id=460174#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133110

Files:
  lld/COFF/Writer.cpp
  lld/ELF/Writer.cpp
  lld/MachO/Writer.cpp
  lld/test/ELF/link-open-file.test
  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/test/ELF/link-open-file.test
===================================================================
--- lld/test/ELF/link-open-file.test
+++ lld/test/ELF/link-open-file.test
@@ -12,7 +12,7 @@
 
 # RUN:     %python %s %t.o 7
 # RUN: not %python %s %t.o 3 2>&1 | FileCheck %s
-# CHECK: error: failed to write to the output file
+# CHECK: error: failed to write output '{{.*}}': {{.*}}
 
 import contextlib
 import ctypes
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
@@ -589,7 +589,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.460174.patch
Type: text/x-patch
Size: 2197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220914/d4747e69/attachment.bin>


More information about the llvm-commits mailing list