From 123e3786917997a2249299439e836115c73a53c5 Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Wed, 20 Jan 2021 09:45:03 -0500 Subject: [release-branch.go1.14] cmd/go: fix mod_get_fallback test Fixes #43796 Change-Id: I3d791d0ac9ce0b523c78c649aaf5e339a7f63b76 Reviewed-on: https://go-review.googlesource.com/c/go/+/284797 Trust: Jay Conrod Run-TryBot: Jay Conrod Reviewed-by: Bryan C. Mills TryBot-Result: Go Bot (cherry picked from commit be28e5abc5ddca0d6b2d8c91b7bb9c05717154e7) Reviewed-on: https://go-review.googlesource.com/c/go/+/284798 --- src/cmd/go/testdata/script/mod_get_fallback.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/go/testdata/script/mod_get_fallback.txt b/src/cmd/go/testdata/script/mod_get_fallback.txt index a9834a324e..9733fa366b 100644 --- a/src/cmd/go/testdata/script/mod_get_fallback.txt +++ b/src/cmd/go/testdata/script/mod_get_fallback.txt @@ -6,5 +6,5 @@ env GOPROXY=https://proxy.golang.org,direct env GOSUMDB=off go get -x -v -d golang.org/x/tools/cmd/goimports -stderr '# get https://proxy.golang.org/golang.org/x/tools/@latest' +stderr '# get https://proxy.golang.org/golang.org/x/tools/@v/list' ! stderr '# get https://golang.org' -- cgit v1.2.3-54-g00ecf From b57ea3d3a4a49ffea832fb5f923c2d16eb7d2eb2 Mon Sep 17 00:00:00 2001 From: Roland Shoemaker Date: Wed, 20 Jan 2021 09:06:12 -0800 Subject: [release-branch.go1.14] internal/execabs: only run tests on platforms that support them Fixes #43792 Change-Id: I3bf022a28b194f0089ea96d93e56bbd9fb7e0aa8 Reviewed-on: https://go-review.googlesource.com/c/go/+/285055 Trust: Roland Shoemaker Run-TryBot: Roland Shoemaker Reviewed-by: Dmitri Shuralyov --- src/internal/execabs/execabs_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/internal/execabs/execabs_test.go b/src/internal/execabs/execabs_test.go index a0b88dd2a0..1a197b8701 100644 --- a/src/internal/execabs/execabs_test.go +++ b/src/internal/execabs/execabs_test.go @@ -7,6 +7,7 @@ package execabs import ( "context" "fmt" + "internal/testenv" "io/ioutil" "os" "os/exec" @@ -30,6 +31,8 @@ func TestFixCmd(t *testing.T) { } func TestCommand(t *testing.T) { + testenv.MustHaveExec(t) + for _, cmd := range []func(string) *Cmd{ func(s string) *Cmd { return Command(s) }, func(s string) *Cmd { return CommandContext(context.Background(), s) }, @@ -71,6 +74,8 @@ func TestCommand(t *testing.T) { } func TestLookPath(t *testing.T) { + testenv.MustHaveExec(t) + tmpDir, err := ioutil.TempDir("", "execabs-test") if err != nil { t.Fatalf("ioutil.TempDir failed: %s", err) -- cgit v1.2.3-54-g00ecf From cb39368e2487841f5440ec9a622ef988f62c03b7 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Thu, 7 Jan 2021 14:57:53 -0800 Subject: [release-branch.go1.14] cmd/compile: don't short-circuit copies whose source is volatile Current optimization: When we copy a->b and then b->c, we might as well copy a->c instead of b->c (then b might be dead and go away). *Except* if a is a volatile location (might be clobbered by a call). In that case, we really do want to copy a immediately, because there might be a call before we can do the a->c copy. User calls can't happen in between, because the rule matches up the memory states. But calls inserted for memory barriers, particularly runtime.typedmemmove, can. (I guess we could introduce a register-calling-convention version of runtime.typedmemmove, but that seems a bigger change than this one.) Fixes #43574 Change-Id: Ifa518bb1a6f3a8dd46c352d4fd54ea9713b3eb1a Reviewed-on: https://go-review.googlesource.com/c/go/+/282492 Trust: Keith Randall Trust: Josh Bleecher Snyder Run-TryBot: Keith Randall TryBot-Result: Go Bot Reviewed-by: Josh Bleecher Snyder (cherry picked from commit 304f769ffc68e64244266b3aadbf91e6738c0064) Reviewed-on: https://go-review.googlesource.com/c/go/+/282559 --- src/cmd/compile/internal/ssa/gen/generic.rules | 4 +-- src/cmd/compile/internal/ssa/rewritegeneric.go | 8 +++--- test/fixedbugs/issue43570.go | 40 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 test/fixedbugs/issue43570.go diff --git a/src/cmd/compile/internal/ssa/gen/generic.rules b/src/cmd/compile/internal/ssa/gen/generic.rules index 87cfd3da0f..89368ed732 100644 --- a/src/cmd/compile/internal/ssa/gen/generic.rules +++ b/src/cmd/compile/internal/ssa/gen/generic.rules @@ -2351,7 +2351,7 @@ (Move {t1} [s] dst tmp1 midmem:(Move {t2} [s] tmp2 src _)) && t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) - && isStackPtr(src) + && isStackPtr(src) && !isVolatile(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config)) -> (Move {t1} [s] dst src midmem) @@ -2360,7 +2360,7 @@ (Move {t1} [s] dst tmp1 midmem:(VarDef (Move {t2} [s] tmp2 src _))) && t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) - && isStackPtr(src) + && isStackPtr(src) && !isVolatile(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config)) -> (Move {t1} [s] dst src midmem) diff --git a/src/cmd/compile/internal/ssa/rewritegeneric.go b/src/cmd/compile/internal/ssa/rewritegeneric.go index d65d900843..72abaf2f9a 100644 --- a/src/cmd/compile/internal/ssa/rewritegeneric.go +++ b/src/cmd/compile/internal/ssa/rewritegeneric.go @@ -32031,7 +32031,7 @@ func rewriteValuegeneric_OpMove_20(v *Value) bool { return true } // match: (Move {t1} [s] dst tmp1 midmem:(Move {t2} [s] tmp2 src _)) - // cond: t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config)) + // cond: t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && !isVolatile(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config)) // result: (Move {t1} [s] dst src midmem) for { s := v.AuxInt @@ -32047,7 +32047,7 @@ func rewriteValuegeneric_OpMove_20(v *Value) bool { _ = midmem.Args[2] tmp2 := midmem.Args[0] src := midmem.Args[1] - if !(t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config))) { + if !(t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && !isVolatile(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config))) { break } v.reset(OpMove) @@ -32059,7 +32059,7 @@ func rewriteValuegeneric_OpMove_20(v *Value) bool { return true } // match: (Move {t1} [s] dst tmp1 midmem:(VarDef (Move {t2} [s] tmp2 src _))) - // cond: t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config)) + // cond: t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && !isVolatile(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config)) // result: (Move {t1} [s] dst src midmem) for { s := v.AuxInt @@ -32079,7 +32079,7 @@ func rewriteValuegeneric_OpMove_20(v *Value) bool { _ = midmem_0.Args[2] tmp2 := midmem_0.Args[0] src := midmem_0.Args[1] - if !(t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config))) { + if !(t1.(*types.Type).Compare(t2.(*types.Type)) == types.CMPeq && isSamePtr(tmp1, tmp2) && isStackPtr(src) && !isVolatile(src) && disjoint(src, s, tmp2, s) && (disjoint(src, s, dst, s) || isInlinableMemmove(dst, src, s, config))) { break } v.reset(OpMove) diff --git a/test/fixedbugs/issue43570.go b/test/fixedbugs/issue43570.go new file mode 100644 index 0000000000..d073fde5f6 --- /dev/null +++ b/test/fixedbugs/issue43570.go @@ -0,0 +1,40 @@ +// run + +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "fmt" + +type T [8]*int + +//go:noinline +func f(x int) T { + return T{} +} + +//go:noinline +func g(x int, t T) { + if t != (T{}) { + panic(fmt.Sprintf("bad: %v", t)) + } +} + +func main() { + const N = 10000 + var q T + func() { + for i := 0; i < N; i++ { + q = f(0) + g(0, q) + sink = make([]byte, 1024) + } + }() + // Note that the closure is a trick to get the write to q to be a + // write to a pointer that is known to be non-nil and requires + // a write barrier. +} + +var sink []byte -- cgit v1.2.3-54-g00ecf From a2e2011637b47572f66cb2715b887737bb0e191f Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Fri, 29 Jan 2021 12:04:28 -0800 Subject: [release-branch.go1.14] net/http: update bundled x/net/http2 Updates bundled http2 to x/net git rev 4acb7895a for: http2: send a nil error if we cancel a delayed body write https://golang.org/cl/288114 http2: wait until the request body has been written https://golang.org/cl/288113 Created by: go get -d golang.org/x/net@release-branch.go1.14 go mod tidy go mod vendor go generate -run=bundle std Fixes #42586. Change-Id: Ib5aecaeb1deb13b8f0e51a864b60eede248aef0d Reviewed-on: https://go-review.googlesource.com/c/go/+/288115 Trust: Damien Neil Reviewed-by: Dmitri Shuralyov --- src/go.mod | 2 +- src/go.sum | 4 ++-- src/net/http/h2_bundle.go | 12 ++++++++++-- src/vendor/modules.txt | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/go.mod b/src/go.mod index faf848d5df..ec6bd98052 100644 --- a/src/go.mod +++ b/src/go.mod @@ -4,7 +4,7 @@ go 1.14 require ( golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d - golang.org/x/net v0.0.0-20201029202311-70d85028bad3 + golang.org/x/net v0.0.0-20210129194117-4acb7895a057 golang.org/x/sys v0.0.0-20200201011859-915c9c3d4ccf // indirect golang.org/x/text v0.3.3-0.20191031172631-4b67af870c6f // indirect ) diff --git a/src/go.sum b/src/go.sum index 58d6621a2f..171e083b81 100644 --- a/src/go.sum +++ b/src/go.sum @@ -2,8 +2,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d h1:9FCpayM9Egr1baVnV1SX0H87m+XB0B8S0hAMi99X/3U= golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20201029202311-70d85028bad3 h1:zhmuDiUI8/S25xjIBeUn8XwfxP7SKYR41pTuOoa1O+w= -golang.org/x/net v0.0.0-20201029202311-70d85028bad3/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210129194117-4acb7895a057 h1:HThQeV5c0Ab/Puir+q6mC97b7+3dfZdsLWMLoBrzo68= +golang.org/x/net v0.0.0-20210129194117-4acb7895a057/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200201011859-915c9c3d4ccf h1:+4j7oujXP478CVb/AFvHJmVX5+Pczx2NGts5yirA0oY= diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 0e9139b9ef..8f39241b2c 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -7593,6 +7593,9 @@ func (cc *http2ClientConn) roundTrip(req *Request) (res *Response, gotErrAfterRe // we can keep it. bodyWriter.cancel() cs.abortRequestBodyWrite(http2errStopReqBodyWrite) + if hasBody && !bodyWritten { + <-bodyWriter.resc + } } if re.err != nil { cc.forgetStreamID(cs.ID) @@ -7613,6 +7616,7 @@ func (cc *http2ClientConn) roundTrip(req *Request) (res *Response, gotErrAfterRe } else { bodyWriter.cancel() cs.abortRequestBodyWrite(http2errStopReqBodyWriteAndCancel) + <-bodyWriter.resc } cc.forgetStreamID(cs.ID) return nil, cs.getStartedWrite(), http2errTimeout @@ -7622,6 +7626,7 @@ func (cc *http2ClientConn) roundTrip(req *Request) (res *Response, gotErrAfterRe } else { bodyWriter.cancel() cs.abortRequestBodyWrite(http2errStopReqBodyWriteAndCancel) + <-bodyWriter.resc } cc.forgetStreamID(cs.ID) return nil, cs.getStartedWrite(), ctx.Err() @@ -7631,6 +7636,7 @@ func (cc *http2ClientConn) roundTrip(req *Request) (res *Response, gotErrAfterRe } else { bodyWriter.cancel() cs.abortRequestBodyWrite(http2errStopReqBodyWriteAndCancel) + <-bodyWriter.resc } cc.forgetStreamID(cs.ID) return nil, cs.getStartedWrite(), http2errRequestCanceled @@ -7640,6 +7646,7 @@ func (cc *http2ClientConn) roundTrip(req *Request) (res *Response, gotErrAfterRe // forgetStreamID. return nil, cs.getStartedWrite(), cs.resetErr case err := <-bodyWriter.resc: + bodyWritten = true // Prefer the read loop's response, if available. Issue 16102. select { case re := <-readLoopResCh: @@ -7650,7 +7657,6 @@ func (cc *http2ClientConn) roundTrip(req *Request) (res *Response, gotErrAfterRe cc.forgetStreamID(cs.ID) return nil, cs.getStartedWrite(), err } - bodyWritten = true if d := cc.responseHeaderTimeout(); d != 0 { timer := time.NewTimer(d) defer timer.Stop() @@ -9055,7 +9061,9 @@ func (t *http2Transport) getBodyWriterState(cs *http2clientStream, body io.Reade func (s http2bodyWriterState) cancel() { if s.timer != nil { - s.timer.Stop() + if s.timer.Stop() { + s.resc <- nil + } } } diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 7c6c478b12..669bd9bbc2 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -8,7 +8,7 @@ golang.org/x/crypto/curve25519 golang.org/x/crypto/hkdf golang.org/x/crypto/internal/subtle golang.org/x/crypto/poly1305 -# golang.org/x/net v0.0.0-20201029202311-70d85028bad3 +# golang.org/x/net v0.0.0-20210129194117-4acb7895a057 ## explicit golang.org/x/net/dns/dnsmessage golang.org/x/net/http/httpguts -- cgit v1.2.3-54-g00ecf From e09d8d250fe014439a87d1ae1e3c4d8f1e606b42 Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Fri, 22 Jan 2021 14:27:24 -0500 Subject: [release-branch.go1.14] cmd/go: don't lookup the path for CC when invoking cgo Previously, if CC was a path without separators (like gcc or clang), we'd look it up in PATH in cmd/go using internal/execabs.LookPath, then pass the resolved path to cgo in CC. This caused a regression: if the directory in PATH containing CC has a space, cgo splits it and interprets it as multiple arguments. With this change, cmd/go no longer resolves CC before invoking cgo. cgo does the path lookup on each invocation. This reverts the security fix CL 284780, but that was redundant with the addition of internal/execabs (CL 955304), which still protects us. NOTE: This CL includes a related test fix from CL 286292. Fixes #43859 Change-Id: I65d91a1e303856df8653881eb6e2e75a3bf95c49 Reviewed-on: https://go-review.googlesource.com/c/go/+/285873 Trust: Jay Conrod Run-TryBot: Jay Conrod TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills (cherry picked from commit a2cef9b544708ecae983ed8836ee2425a28aab68) Reviewed-on: https://go-review.googlesource.com/c/go/+/285952 --- src/cmd/go/internal/work/action.go | 3 -- src/cmd/go/internal/work/exec.go | 27 ++++---------- src/cmd/go/testdata/script/cgo_path.txt | 12 +++++-- src/cmd/go/testdata/script/cgo_path_space.txt | 52 +++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 26 deletions(-) create mode 100644 src/cmd/go/testdata/script/cgo_path_space.txt diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go index 8256681fd2..e3cb87fbb9 100644 --- a/src/cmd/go/internal/work/action.go +++ b/src/cmd/go/internal/work/action.go @@ -56,9 +56,6 @@ type Builder struct { id sync.Mutex toolIDCache map[string]string // tool name -> tool ID buildIDCache map[string]string // file name -> build ID - - cgoEnvOnce sync.Once - cgoEnvCache []string } // NOTE: Much of Action would not need to be exported if not for test. diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 8230d85938..1c50f47815 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -1076,7 +1076,10 @@ func (b *Builder) vet(a *Action) error { } // TODO(rsc): Why do we pass $GCCGO to go vet? - env := b.cgoEnv() + env := b.cCompilerEnv() + if cfg.BuildToolchainName == "gccgo" { + env = append(env, "GCCGO="+BuildToolchain.compiler()) + } p := a.Package tool := VetTool @@ -1980,24 +1983,6 @@ func (b *Builder) cCompilerEnv() []string { return []string{"TERM=dumb"} } -// cgoEnv returns environment variables to set when running cgo. -// Some of these pass through to cgo running the C compiler, -// so it includes cCompilerEnv. -func (b *Builder) cgoEnv() []string { - b.cgoEnvOnce.Do(func() { - cc, err := exec.LookPath(b.ccExe()[0]) - if err != nil || filepath.Base(cc) == cc { // reject relative path - cc = "/missing-cc" - } - gccgo := GccgoBin - if filepath.Base(gccgo) == gccgo { // reject relative path - gccgo = "/missing-gccgo" - } - b.cgoEnvCache = append(b.cCompilerEnv(), "CC="+cc, "GCCGO="+gccgo) - }) - return b.cgoEnvCache -} - // mkdir makes the named directory. func (b *Builder) Mkdir(dir string) error { // Make Mkdir(a.Objdir) a no-op instead of an error when a.Objdir == "". @@ -2543,7 +2528,7 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo // along to the host linker. At this point in the code, cgoLDFLAGS // consists of the original $CGO_LDFLAGS (unchecked) and all the // flags put together from source code (checked). - cgoenv := b.cgoEnv() + cgoenv := b.cCompilerEnv() if len(cgoLDFLAGS) > 0 { flags := make([]string, len(cgoLDFLAGS)) for i, f := range cgoLDFLAGS { @@ -2764,7 +2749,7 @@ func (b *Builder) dynimport(a *Action, p *load.Package, objdir, importGo, cgoExe if p.Standard && p.ImportPath == "runtime/cgo" { cgoflags = []string{"-dynlinker"} // record path to dynamic linker } - return b.run(a, p.Dir, p.ImportPath, b.cgoEnv(), cfg.BuildToolexec, cgoExe, "-dynpackage", p.Name, "-dynimport", dynobj, "-dynout", importGo, cgoflags) + return b.run(a, p.Dir, p.ImportPath, b.cCompilerEnv(), cfg.BuildToolexec, cgoExe, "-dynpackage", p.Name, "-dynimport", dynobj, "-dynout", importGo, cgoflags) } // Run SWIG on all SWIG input files. diff --git a/src/cmd/go/testdata/script/cgo_path.txt b/src/cmd/go/testdata/script/cgo_path.txt index e4d07dea2c..548a65ffa8 100644 --- a/src/cmd/go/testdata/script/cgo_path.txt +++ b/src/cmd/go/testdata/script/cgo_path.txt @@ -1,12 +1,20 @@ [!cgo] skip +# Set CC explicitly to something that requires a PATH lookup. +# Normally, the default is gcc or clang, but if CC was set during make.bash, +# that becomes the default. +[exec:clang] env CC=clang +[exec:gcc] env CC=gcc +[!exec:clang] [!exec:gcc] skip 'Unknown C compiler' + env GOCACHE=$WORK/gocache # Looking for compile flags, so need a clean cache. [!windows] env PATH=.:$PATH -[!windows] chmod 0777 p/gcc p/clang +[!windows] chmod 0755 p/gcc p/clang [!windows] exists p/gcc p/clang [windows] exists p/gcc.bat p/clang.bat ! exists p/bug.txt -go build -x +! go build -x +stderr '^cgo: exec (clang|gcc): (clang|gcc) resolves to executable in current directory \(.[/\\](clang|gcc)(.bat)?\)$' ! exists p/bug.txt -- go.mod -- diff --git a/src/cmd/go/testdata/script/cgo_path_space.txt b/src/cmd/go/testdata/script/cgo_path_space.txt new file mode 100644 index 0000000000..3ae8dce3dc --- /dev/null +++ b/src/cmd/go/testdata/script/cgo_path_space.txt @@ -0,0 +1,52 @@ +# Check that if the PATH directory containing the C compiler has a space, +# we can still use that compiler with cgo. +# Verifies #43808. +[!cgo] skip + +# Set CC explicitly to something that requires a PATH lookup. +# Normally, the default is gcc or clang, but if CC was set during make.bash, +# that becomes the default. +[exec:clang] env CC=clang +[exec:gcc] env CC=gcc +[!exec:clang] [!exec:gcc] skip 'Unknown C compiler' + +[!windows] chmod 0755 $WORK/'program files'/clang +[!windows] chmod 0755 $WORK/'program files'/gcc +[!windows] env PATH=$WORK/'program files':$PATH +[windows] env PATH=$WORK\'program files';%PATH% + +! exists $WORK/log.txt +! go build -x +exists $WORK/log.txt +rm $WORK/log.txt + +# TODO(#41400, #43078): when CC is set explicitly, it should be allowed to +# contain spaces separating arguments, and it should be possible to quote +# arguments with spaces (including the path), as in CGO_CFLAGS and other +# variables. For now, this doesn't work. +[!windows] env CC=$WORK/'program files'/gcc +[windows] env CC=$WORK\'program files'\gcc.bat +! go build -x +! exists $WORK/log.txt + +-- go.mod -- +module m + +-- m.go -- +package m + +// #define X 1 +import "C" + +-- $WORK/program files/gcc -- +#!/bin/sh + +echo ok >$WORK/log.txt +-- $WORK/program files/clang -- +#!/bin/sh + +echo ok >$WORK/log.txt +-- $WORK/program files/gcc.bat -- +echo ok >%WORK%\log.txt +-- $WORK/program files/clang.bat -- +echo ok >%WORK%\log.txt -- cgit v1.2.3-54-g00ecf From 6a64f5f8beae0b3556f2fba2c4a89911a9e00140 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 25 Dec 2020 11:14:11 +0100 Subject: [release-branch.go1.14] runtime/cgo: fix Android build with NDK 22 Fixes #43405 Change-Id: I7d2b70098a4ba4dcb325fb0be076043789b86135 Reviewed-on: https://go-review.googlesource.com/c/go/+/280312 Run-TryBot: Elias Naur TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Trust: Elias Naur (cherry picked from commit 1d78139128d6d839d7da0aeb10b3e51b6c7c0749) Reviewed-on: https://go-review.googlesource.com/c/go/+/289150 --- src/runtime/cgo/gcc_linux_386.c | 2 +- src/runtime/cgo/gcc_linux_amd64.c | 2 +- src/runtime/cgo/gcc_linux_arm.c | 2 +- src/runtime/cgo/gcc_linux_arm64.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/cgo/gcc_linux_386.c b/src/runtime/cgo/gcc_linux_386.c index ece9f933c5..70c942aeb8 100644 --- a/src/runtime/cgo/gcc_linux_386.c +++ b/src/runtime/cgo/gcc_linux_386.c @@ -12,7 +12,7 @@ static void *threadentry(void*); static void (*setg_gcc)(void*); // This will be set in gcc_android.c for android-specific customization. -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); void x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) diff --git a/src/runtime/cgo/gcc_linux_amd64.c b/src/runtime/cgo/gcc_linux_amd64.c index 9134e0df92..f2bf6482cb 100644 --- a/src/runtime/cgo/gcc_linux_amd64.c +++ b/src/runtime/cgo/gcc_linux_amd64.c @@ -14,7 +14,7 @@ static void* threadentry(void*); static void (*setg_gcc)(void*); // This will be set in gcc_android.c for android-specific customization. -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); void x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) diff --git a/src/runtime/cgo/gcc_linux_arm.c b/src/runtime/cgo/gcc_linux_arm.c index 61855b96b2..5bc0fee90d 100644 --- a/src/runtime/cgo/gcc_linux_arm.c +++ b/src/runtime/cgo/gcc_linux_arm.c @@ -10,7 +10,7 @@ static void *threadentry(void*); -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); static void (*setg_gcc)(void*); void diff --git a/src/runtime/cgo/gcc_linux_arm64.c b/src/runtime/cgo/gcc_linux_arm64.c index 261c884ac9..17ff274fbb 100644 --- a/src/runtime/cgo/gcc_linux_arm64.c +++ b/src/runtime/cgo/gcc_linux_arm64.c @@ -12,7 +12,7 @@ static void *threadentry(void*); -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); static void (*setg_gcc)(void*); void -- cgit v1.2.3-54-g00ecf From 5cf057ddedfbb149b71c85ec86050431dd6b2d9d Mon Sep 17 00:00:00 2001 From: Carlos Amedee Date: Thu, 4 Feb 2021 11:17:08 -0500 Subject: [release-branch.go1.14] go1.14.15 Change-Id: I8b8891ff335a44664c931acddb705bea453069db Reviewed-on: https://go-review.googlesource.com/c/go/+/289693 Run-TryBot: Carlos Amedee TryBot-Result: Go Bot Reviewed-by: Alexander Rakoczy Trust: Alexander Rakoczy Trust: Carlos Amedee --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 31a26de05c..bac3ce8995 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -go1.14.14 \ No newline at end of file +go1.14.15 \ No newline at end of file -- cgit v1.2.3-54-g00ecf