]> Cypherpunks repositories - gostls13.git/commit
cmd/go: don't copy cgo files to objdir when overlay is present
authorMichael Matloob <matloob@golang.org>
Tue, 27 Oct 2020 21:51:58 +0000 (17:51 -0400)
committerMichael Matloob <matloob@golang.org>
Tue, 10 Nov 2020 16:09:36 +0000 (16:09 +0000)
commite3de852f3e776ca426d1d7af243dd698f0fee960
treed6581bf63f85cb9115b722b7082e885e2d13bce6
parent189931296f6b56090d9d7f49b7936b817189d87d
cmd/go: don't copy cgo files to objdir when overlay is present

The previous cl (golang.org/cl/262618) copied non-overlaid cgo files
to objdir, mostly to get around the issue that otherwise cgo-generated
files were written out with the wrong names (they'd get the base path
of the overlay file containing the replaced contents, instead of the
base path of the path whose contents are being replaced). So that CL
it would copy the files to objdir with the base path of the file
being replaced to circumvent that.

This CL changes cmd/go and cmd/cgo so that instead of copying
files, it passes the actual path of the file on disk either of
the original file (if it is not overlaid) or its replacement
file (if it is) as well as a flag --path_rewrite, newly added to
cmd/cgo, that specifies the actual original file path that corresponds
to the replaced files.

Updates #39958

Change-Id: Ic4aae5ef77fe405011fcdce7f6c162488d13daa2
Reviewed-on: https://go-review.googlesource.com/c/go/+/265758
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/work/exec.go
src/cmd/go/testdata/script/build_overlay.txt