[COFF] Check errorCount before committing the output file
authorMartin Storsjo <martin@martin.st>
Tue, 20 Aug 2019 21:08:14 +0000 (21:08 +0000)
committerMartin Storsjo <martin@martin.st>
Tue, 20 Aug 2019 21:08:14 +0000 (21:08 +0000)
commit08a5a0aa252aca6e5d7c82247075072d317f1925
tree1cf51e58abb8cc8a6d3915c066d381f869e27019
parenta99086dbdd92a39ad130f407fad82fee975f986b
[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

llvm-svn: 369445
lld/COFF/Writer.cpp
lld/test/COFF/multiple-resource-objs.test