Skip to content

Commit

Permalink
cmd/link: always mark runtime.buildVersion and runtime.modinfo reachable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Run-TryBot: Cherry Zhang <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
Reviewed-by: Jeremy Faller <[email protected]>
TryBot-Result: Go Bot <[email protected]>
  • Loading branch information
cherrymui committed Oct 12, 2020
1 parent 8994607 commit 3a34395
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cmd/link/internal/ld/deadcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 3a34395

Please sign in to comment.