From 41e5ae4883b2f3c32958731ef589488f4fc06449 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 14 Apr 2021 19:53:59 -0400 Subject: [PATCH] cmd/link: deal with no constructors Change-Id: I6ed153b780c70fa90822e4daa5749478ac43afca Reviewed-on: https://go-review.googlesource.com/c/go/+/312034 Trust: Russ Cox Run-TryBot: Russ Cox Reviewed-by: Cherry Zhang TryBot-Result: Go Bot --- src/cmd/link/internal/ld/pe.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/link/internal/ld/pe.go b/src/cmd/link/internal/ld/pe.go index 30654412b98..b70c0693e85 100644 --- a/src/cmd/link/internal/ld/pe.go +++ b/src/cmd/link/internal/ld/pe.go @@ -607,6 +607,10 @@ dwarfLoop: Errorf(nil, "emitRelocations: could not find %q section", sect.Name) } + if f.ctorsSect == nil { + return + } + f.ctorsSect.emitRelocations(ctxt.Out, func() int { dottext := ldr.Lookup(".text", 0) ctxt.Out.Write32(0)