Index: lib/LTO/LTOCodeGenerator.cpp =================================================================== --- lib/LTO/LTOCodeGenerator.cpp +++ lib/LTO/LTOCodeGenerator.cpp @@ -257,6 +257,9 @@ bool genResult = compileOptimized(&objFile.os()); objFile.os().close(); if (objFile.os().has_error()) { + std::string ErrMsg = "could not write object file: "; + ErrMsg += Filename; + emitError(ErrMsg); objFile.os().clear_error(); sys::fs::remove(Twine(Filename)); return false;