]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: remove _cgo_flags from gccgo archive built using SWIG
authorIan Lance Taylor <iant@golang.org>
Tue, 1 Nov 2016 20:04:56 +0000 (13:04 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 1 Nov 2016 21:47:42 +0000 (21:47 +0000)
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 <iant@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
src/cmd/go/build.go

index 641fa09360a3dbc6eb387b20dfa509dda261abfc..e3a23b8d266f24b4c431baf14edbf3ce1f1e8338 100644 (file)
@@ -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