]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: don't copy cgo files to objdir when overlay is present
authorMichael Matloob <matloob@golang.org>
Tue, 10 Nov 2020 18:59:48 +0000 (13:59 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 11 Nov 2020 16:22:54 +0000 (16:22 +0000)
commit28437546f4624ffef6a2d082266d0d808a0d3423
tree039ac885bd42fa720ad3d8711340f755ffea2170
parentc906608406f22087e9bc3ee7616c3f1fbba2503b
cmd/go: don't copy cgo files to objdir when overlay is present

This cl is a roll-forward of golang.org/cl/265758, which was rolled back
in golang.org/cl/268900. The changes made are removing cgofiles
from the list of files that are copied to objdir (because the cgofiles
themselves aren't actually provided to the compiler) and fixing test
cases to properly provide the overlay flag and to allow for paths with
backslashes (as in Windows).

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