[lld] r369445 - [COFF] Check errorCount before committing the output file
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 05:56:31 PDT 2019
Merged to release_90 in r369752
On Tue, Aug 20, 2019 at 11:07 PM Martin Storsjo via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
> Author: mstorsjo
> Date: Tue Aug 20 14:08:14 2019
> New Revision: 369445
>
> URL: http://llvm.org/viewvc/llvm-project?rev=369445&view=rev
> Log:
> [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/trunk/COFF/Writer.cpp
> lld/trunk/test/COFF/multiple-resource-objs.test
>
> Modified: lld/trunk/COFF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=369445&r1=369444&r2=369445&view=diff
> ==============================================================================
> --- lld/trunk/COFF/Writer.cpp (original)
> +++ lld/trunk/COFF/Writer.cpp Tue Aug 20 14:08:14 2019
> @@ -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)));
>
> Modified: lld/trunk/test/COFF/multiple-resource-objs.test
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/multiple-resource-objs.test?rev=369445&r1=369444&r2=369445&view=diff
> ==============================================================================
> --- lld/trunk/test/COFF/multiple-resource-objs.test (original)
> +++ lld/trunk/test/COFF/multiple-resource-objs.test Tue Aug 20 14:08:14 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
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list