aboutsummaryrefslogtreecommitdiff
path: root/COFF/Writer.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2019-08-23 12:56:03 +0000
committerHans Wennborg <hans@hanshq.net>2019-08-23 12:56:03 +0000
commita9eab33af4b01008cd496acb0876ebfb1af70ae9 (patch)
tree356fae1b81e331d5f0ce64bf5bd9f64a5d57547c /COFF/Writer.cpp
parent58617997a173cf6c5ffc624e09cdd219a1bf6fd5 (diff)
Merging r369445:
------------------------------------------------------------------------ r369445 | mstorsjo | 2019-08-20 23:08:14 +0200 (Tue, 20 Aug 2019) | 9 lines [COFF] Check errorCount before committing the output file This avoids producing an output file if errors appeared late in the linking process (e.g. while fixing relocations, or as in the test, while checking for multiple resources). If an output file is produced, build tools might not retry building it on rebuilds, even if a previous build failed due to the error return code. Differential Revision: https://reviews.llvm.org/D66491 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/lld/branches/release_90@369752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'COFF/Writer.cpp')
-rw-r--r--COFF/Writer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/COFF/Writer.cpp b/COFF/Writer.cpp
index 9bc2f092c..573628195 100644
--- a/COFF/Writer.cpp
+++ b/COFF/Writer.cpp
@@ -626,6 +626,9 @@ void Writer::run() {
writeMapFile(outputSections);
+ if (errorCount())
+ return;
+
ScopedTimer t2(diskCommitTimer);
if (auto e = buffer->commit())
fatal("failed to write the output file: " + toString(std::move(e)));