From 2ddab6d186f295f23027f64817aa7a09d05916e4 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Tue, 17 Jan 2017 13:50:34 +0000 Subject: [PATCH] [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 --- lld/ELF/Writer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index fb0e3b85c87a..fc41e7284c95 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -217,6 +217,9 @@ template void Writer::run() { 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)