cmd/go: use the resolved buildmode in build IDs and build info#80312
cmd/go: use the resolved buildmode in build IDs and build info#80312harjothkhara wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Couple scope notes:
|
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 golang#63559
7762fff to
1ddf5bf
Compare
|
This PR (HEAD: 1ddf5bf) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/798680. Important tips:
|
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