From: Joel Sing Date: Tue, 13 Sep 2022 09:28:58 +0000 (+1000) Subject: cmd/link: generate an error if the entry symbol cannot be found X-Git-Tag: go1.20rc1~1072 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=77420fa119643163f820be7752668a69100487d7;p=gostls13.git cmd/link: generate an error if the entry symbol cannot be found If the entry symbol cannot be found (for example, a new port is being brought up and no rt0 code has been provided), the linker will currently panic. Rather than panicing, generate an error that aids in debugging: missing entry symbol "_rt0_arm64_openbsd" Change-Id: I9cc38eaab48f730d596ca7fa9e9e3d68250ae4d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/430555 Auto-Submit: Jenny Rakoczy TryBot-Result: Gopher Robot Reviewed-by: Jenny Rakoczy Run-TryBot: Cherry Mui Reviewed-by: Cherry Mui --- diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 14dc5433fb..ca343ab2f9 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -2435,6 +2435,10 @@ func Entryvalue(ctxt *Link) int64 { } ldr := ctxt.loader s := ldr.Lookup(a, 0) + if s == 0 { + Errorf(nil, "missing entry symbol %q", a) + return 0 + } st := ldr.SymType(s) if st == 0 { return *FlagTextAddr