Index: lld/trunk/COFF/Writer.cpp =================================================================== --- lld/trunk/COFF/Writer.cpp +++ lld/trunk/COFF/Writer.cpp @@ -628,6 +628,9 @@ writeMapFile(outputSections); + if (errorCount()) + return; + ScopedTimer t2(diskCommitTimer); if (auto e = buffer->commit()) fatal("failed to write the output file: " + toString(std::move(e))); Index: lld/trunk/test/COFF/multiple-resource-objs.test =================================================================== --- lld/trunk/test/COFF/multiple-resource-objs.test +++ lld/trunk/test/COFF/multiple-resource-objs.test @@ -1,7 +1,9 @@ # RUN: llvm-cvtres /out:%t_resource.obj %S/Inputs/resource.res # RUN: llvm-cvtres /out:%t_id.obj %S/Inputs/id.res +# RUN: rm -f %t.exe # RUN: not lld-link /out:%t.exe /dll /noentry %t_id.obj %t_resource.obj 2>&1 | \ # RUN: FileCheck --check-prefix=TWOOBJ %s +# RUN: not test -f %t.exe TWOOBJ: error: {{.*}}_resource.obj: more than one resource obj file not allowed, already got {{.*}}_id.obj