aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/deadcode.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-12-06 13:38:04 -0500
committerRuss Cox <rsc@golang.org>2021-12-07 20:14:56 +0000
commitb37a5391f9e452aa779205add12bd89f44e3fcf0 (patch)
tree38489628da587462da8fc40a7e39173e9aaca7e1 /src/cmd/link/internal/ld/deadcode.go
parent4300f105147dc0da9d1034704ad1cd24bedde5da (diff)
downloadgo-b37a5391f9e452aa779205add12bd89f44e3fcf0.tar.xz
cmd/link, cmd/go: make version info easier to extract
Reading the version information to date has required evaluating two pointers to strings (which themselves contain pointers to data), which means applying relocations, which can be very system-dependent. To simplify the lookup, inline the string data into the build info blob. This makes go version work on binaries built with external linking on darwin/arm64. Also test that at least the very basics work on a trivial binary, even in short mode. Change-Id: I463088c19e837ae0ce57e1278c7b72e74a80b2c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/369977 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index 7b57a85cde..dba22323b0 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -71,12 +71,6 @@ func (d *deadcodePass) init() {
// runtime.unreachableMethod is a function that will throw if called.
// We redirect unreachable methods to it.
names = append(names, "runtime.unreachableMethod")
- 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")