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) { 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/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 void Writer::run() { 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.