]> Cypherpunks repositories - gostls13.git/commit
cmd/link, cmd/go: make version info easier to extract
authorRuss Cox <rsc@golang.org>
Mon, 6 Dec 2021 18:38:04 +0000 (13:38 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 7 Dec 2021 20:14:56 +0000 (20:14 +0000)
commitb37a5391f9e452aa779205add12bd89f44e3fcf0
tree38489628da587462da8fc40a7e39173e9aaca7e1
parent4300f105147dc0da9d1034704ad1cd24bedde5da
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>
src/cmd/go/internal/modload/build.go
src/cmd/go/internal/work/exec.go
src/cmd/go/testdata/script/version.txt
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/ld.go
src/debug/buildinfo/buildinfo.go