cmd/go: use the resolved buildmode in build IDs and build info When -buildmode=default is used, the link action ID hashed the literal string "default", so building with -buildmode=default and building with the buildmode it resolves to produced binaries that were identical except for their build IDs. Hash the resolved buildmode (ldBuildmode) instead, so that equivalent builds share a build ID and cached link outputs. Additionally, the build info stamped into binaries normalized -buildmode=default to "exe" without accounting for platforms where the default is PIE (android, ios, darwin, and windows without -race), misreporting the buildmode actually given to the linker. Record "pie" on those platforms instead. Together these make it possible to reproduce a binary built with -buildmode=default from its stamped build info alone. Fixes #63559 Change-Id: If3ac6a6a84fbf20097ff3009e228ce07705d6835 GitHub-Last-Rev: 1ddf5bfef00c64cc589d90e4e8bf4257f8d05b88 GitHub-Pull-Request: golang/go#80312 Reviewed-on: https://go-review.googlesource.com/c/go/+/798680 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Michael Pratt <mpratt@google.com>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attribution license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.