[lld] r369752 - Merging r369445:

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 05:56:04 PDT 2019


Author: hans
Date: Fri Aug 23 05:56:03 2019
New Revision: 369752

URL: http://llvm.org/viewvc/llvm-project?rev=369752&view=rev
Log:
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
------------------------------------------------------------------------

Modified:
    lld/branches/release_90/   (props changed)
    lld/branches/release_90/COFF/Writer.cpp
    lld/branches/release_90/test/COFF/multiple-resource-objs.test

Propchange: lld/branches/release_90/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 23 05:56:03 2019
@@ -1 +1 @@
-/lld/trunk:366445,366500,366504,366780,366784,367836-367837,368041,368078,368145
+/lld/trunk:366445,366500,366504,366780,366784,367836-367837,368041,368078,368145,369445

Modified: lld/branches/release_90/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_90/COFF/Writer.cpp?rev=369752&r1=369751&r2=369752&view=diff
==============================================================================
--- lld/branches/release_90/COFF/Writer.cpp (original)
+++ lld/branches/release_90/COFF/Writer.cpp Fri Aug 23 05:56:03 2019
@@ -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)));

Modified: lld/branches/release_90/test/COFF/multiple-resource-objs.test
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_90/test/COFF/multiple-resource-objs.test?rev=369752&r1=369751&r2=369752&view=diff
==============================================================================
--- lld/branches/release_90/test/COFF/multiple-resource-objs.test (original)
+++ lld/branches/release_90/test/COFF/multiple-resource-objs.test Fri Aug 23 05:56:03 2019
@@ -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
 




More information about the llvm-commits mailing list