]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] cmd/go: omit build metadata that may contain system paths...
authorBryan C. Mills <bcmills@google.com>
Fri, 27 May 2022 19:54:44 +0000 (15:54 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 25 Jul 2022 23:27:36 +0000 (23:27 +0000)
commitd252fdd630a51db206194b3c41c3d036fdd6f48a
tree2719dc02c0f299163a55211b3b446b91dc5079f3
parent4782f4275c8d006e0346026585e50633a5a31007
[release-branch.go1.18] cmd/go: omit build metadata that may contain system paths when -trimpath is set

CGO flag variables often include system paths for header files and
compiled libraries. The point of -trimpath is to avoid dependending on
system paths, so stamping these variables is counterproductive.

Moreover, the point of stamping build information is to improve
reproducibility. Since we don't also stamp the versions of C
compilers, headers, and libraries used in a cgo build, only the most
trivial cgo programs can be faithfully reproduced from the stamped
information.

Likewise, the -ldflags flag may include system-specific paths,
particularly if external linking is in use. For now, we omit -ldflags
entirely; however, in the future we may instead want to parse and
redact the individual flags.

Updates #52372.
Fixes #53119.

Change-Id: I73318a01cce4371d66955b3261fc7ee58d4b33dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/409174
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
(cherry picked from commit a6e5be0d30770e8bd1ba1e4bac2089218df121d9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/414794
Reviewed-by: Nooras Saba‎ <saba@golang.org>
src/cmd/go/internal/load/pkg.go
src/cmd/go/testdata/script/version_build_settings.txt