1
0
mirror of https://github.com/golang/go synced 2024-11-17 06:04:47 -07:00

cmd/link: always mark runtime.buildVersion and runtime.modinfo reachable

runtime.buildVersion and runtime.modinfo are referenced in the
.go.buildinfo section, therefore reachable. They should normally
be reachable from the runtime. Just make it explicit, in case.

Change-Id: I60ff3132e0bbb690f4a3cba8bb18735921fbe951
Reviewed-on: https://go-review.googlesource.com/c/go/+/261637
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Cherry Zhang 2020-10-12 15:37:21 -04:00
parent 8994607f82
commit 3a34395363

View File

@ -62,6 +62,12 @@ func (d *deadcodePass) init() {
}
}
names = append(names, *flagEntrySymbol)
if !d.ctxt.linkShared && d.ctxt.BuildMode != BuildModePlugin {
// runtime.buildVersion and runtime.modinfo are referenced in .go.buildinfo section
// (see function buildinfo in data.go). They should normally be reachable from the
// runtime. Just make it explicit, in case.
names = append(names, "runtime.buildVersion", "runtime.modinfo")
}
if d.ctxt.BuildMode == BuildModePlugin {
names = append(names, objabi.PathToPrefix(*flagPluginPath)+"..inittask", objabi.PathToPrefix(*flagPluginPath)+".main", "go.plugin.tabs")