From: Cherry Zhang Date: Tue, 19 Jan 2021 16:02:10 +0000 (-0500) Subject: cmd/link: exit before Asmb2 if error X-Git-Tag: go1.16rc1~62 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ccb2e906882e45fe2d22c31049185208adbfb62e;p=gostls13.git cmd/link: exit before Asmb2 if error If there are already errors emitted, don't run the Asmb2 pass and just exit. At the point of Asmb2 relocations are already resolved and errors should have been reported, if any. Asmb2 is unlikely to emit additional useful users errors. Instead, the invalid input may cause inconsistencies and crash the linker, or it may emit some internal errors which are more confusing than helpful. Exit on error before Asmb2. Fixes #43748. Change-Id: Icf6e27f2eef5b6259e921ec0e64bebad5dd805f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/284576 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Than McIntosh --- diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 64f52bc52f..5a096f1b3b 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -338,6 +338,8 @@ func Main(arch *sys.Arch, theArch Arch) { bench.Start("Asmb") asmb(ctxt) + exitIfErrors() + // Generate additional symbols for the native symbol table just prior // to code generation. bench.Start("GenSymsLate")