Skip to content

Commit ccb2e90

Browse files
committed
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 <[email protected]> Run-TryBot: Cherry Zhang <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent ca5774a commit ccb2e90

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/cmd/link/internal/ld/main.go

+2
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ func Main(arch *sys.Arch, theArch Arch) {
338338
bench.Start("Asmb")
339339
asmb(ctxt)
340340

341+
exitIfErrors()
342+
341343
// Generate additional symbols for the native symbol table just prior
342344
// to code generation.
343345
bench.Start("GenSymsLate")

0 commit comments

Comments
 (0)