[ELF] - Do not create huge garbage files on section offset overflow.
Patch changes behavior to not try open the output
file if we already know about error.
That is not just cleaner, but also fixes nasty behavior of linker that
could create huge temporarily files under certain conditions.
Differential revision: https://reviews.llvm.org/D28107
llvm-svn: 292219
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index fb0e3b8..fc41e72 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -217,6 +217,9 @@
fixAbsoluteSymbols();
}
+ // It does not make sense try to open the file if we have error already.
+ if (ErrorCount)
+ return;
// Write the result down to a file.
openFile();
if (ErrorCount)