From: Ian Lance Taylor Date: Tue, 1 Nov 2016 20:04:56 +0000 (-0700) Subject: cmd/go: remove _cgo_flags from gccgo archive built using SWIG X-Git-Tag: go1.8beta1~393 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7c7349c9e9217d7bb22f41eaa658bbba8716bad6;p=gostls13.git cmd/go: remove _cgo_flags from gccgo archive built using SWIG Since SWIG uses cgo, when using SWIG with gccgo, the go tool will add a _cgo_flags file to the package archive, just as it does with cgo. We need to remove that file from the archive passed to the linker, just as we do with cgo. Change-Id: I5ef4fea92eec419f870fbf6f678691d15901ee6c Reviewed-on: https://go-review.googlesource.com/32535 Run-TryBot: Ian Lance Taylor Reviewed-by: Michael Hudson-Doyle --- diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 641fa09360..e3a23b8d26 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -2797,7 +2797,7 @@ func (tools gccgoToolchain) link(b *builder, root *action, out string, allaction if !apackagePathsSeen[a.p.ImportPath] { apackagePathsSeen[a.p.ImportPath] = true target := a.target - if len(a.p.CgoFiles) > 0 { + if len(a.p.CgoFiles) > 0 || a.p.usesSwig() { target, err = readAndRemoveCgoFlags(target) if err != nil { return