Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -246,6 +246,8 @@ if (auto EC = Buffer->commit()) error("failed to write to the output file: " + EC.message()); + if (ErrorCount) + return; // Flush the output streams and exit immediately. A full shutdown // is a good test that we are keeping track of all allocated memory,