summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/Writer.cpp3
-rw-r--r--lld/test/COFF/multiple-resource-objs.test2
2 files changed, 5 insertions, 0 deletions
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index 032439ea32f..0adf155e633 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -628,6 +628,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)));
diff --git a/lld/test/COFF/multiple-resource-objs.test b/lld/test/COFF/multiple-resource-objs.test
index 4263c64be4d..be5f9a28065 100644
--- a/lld/test/COFF/multiple-resource-objs.test
+++ b/lld/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
OpenPOWER on IntegriCloud