mirror of
https://github.com/golang/go
synced 2024-11-26 05:48:05 -07:00
Revert "cmd/go: don't copy cgo files to objdir when overlay is present"
This reverts CL 265758. Reason for revert: longtest builders were failing Change-Id: Ic6c3f3759399e45c1625c7c57f7aa67a1d90c601 Reviewed-on: https://go-review.googlesource.com/c/go/+/268900 Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
0e0a872a76
commit
da3957ad0d
@ -2732,20 +2732,6 @@ OverlayLoop:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite overlaid paths in cgo files.
|
|
||||||
// cgo adds //line and #line pragmas in generated files with these paths.
|
|
||||||
var trimpath []string
|
|
||||||
for i := range cgofiles {
|
|
||||||
path := mkAbs(p.Dir, cgofiles[i])
|
|
||||||
if opath, ok := fsys.OverlayPath(path); ok {
|
|
||||||
cgofiles[i] = opath
|
|
||||||
trimpath = append(trimpath, opath+"=>"+path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(trimpath) > 0 {
|
|
||||||
cgoflags = append(cgoflags, "-trimpath", strings.Join(trimpath, ";"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := b.run(a, execdir, p.ImportPath, cgoenv, cfg.BuildToolexec, cgoExe, "-objdir", objdir, "-importpath", p.ImportPath, cgoflags, "--", cgoCPPFLAGS, cgoCFLAGS, cgofiles); err != nil {
|
if err := b.run(a, execdir, p.ImportPath, cgoenv, cfg.BuildToolexec, cgoExe, "-objdir", objdir, "-importpath", p.ImportPath, cgoflags, "--", cgoCPPFLAGS, cgoCFLAGS, cgofiles); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
36
src/cmd/go/testdata/script/build_overlay.txt
vendored
36
src/cmd/go/testdata/script/build_overlay.txt
vendored
@ -43,12 +43,6 @@ go build -overlay overlay.json -o main_cgo_angle$GOEXE ./cgo_hello_angle
|
|||||||
exec ./main_cgo_angle$GOEXE
|
exec ./main_cgo_angle$GOEXE
|
||||||
stdout '^hello cgo\r?\n'
|
stdout '^hello cgo\r?\n'
|
||||||
|
|
||||||
go list -compiled -overlay -f '{{range .CompiledGoFiles}}{{. | printf "%s\n"}}{{end}}' ./cgo_hello_replace
|
|
||||||
cp stdout compiled_cgo_sources.txt
|
|
||||||
go run ../print_line_comments.go compiled_cgo_sources.txt
|
|
||||||
stdout $GOPATH/src/m/cgo_hello_replace/cgo_hello_replace.go
|
|
||||||
!stdout $GOPATH/src/m/overlay/hello.c
|
|
||||||
|
|
||||||
# Run same tests but with gccgo.
|
# Run same tests but with gccgo.
|
||||||
env GO111MODULE=off
|
env GO111MODULE=off
|
||||||
[!exec:gccgo] stop
|
[!exec:gccgo] stop
|
||||||
@ -213,33 +207,3 @@ void say_hello() { puts("hello cgo\n"); fflush(stdout); }
|
|||||||
|
|
||||||
void say_hello() { puts("hello cgo\n"); fflush(stdout); }
|
void say_hello() { puts("hello cgo\n"); fflush(stdout); }
|
||||||
|
|
||||||
-- print_line_comments.go --
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
compiledGoFilesArg := os.Args[1]
|
|
||||||
b, err := ioutil.ReadFile(compiledGoFilesArg)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
compiledGoFiles := strings.Split(strings.TrimSpace(string(b)), "\n")
|
|
||||||
for _, f := range compiledGoFiles {
|
|
||||||
b, err := ioutil.ReadFile(f)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
for _, line := range strings.Split(string(b), "\n") {
|
|
||||||
if strings.HasPrefix(line, "#line") || strings.HasPrefix(line, "//line") {
|
|
||||||
fmt.Println(line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user