From: Peter Collingbourne Date: Fri, 1 Aug 2014 23:45:33 +0000 (-0700) Subject: cmd/go: use correct link flags if main package contains C++/ObjC files X-Git-Tag: go1.4beta1~964 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fe513d8b3e4a24897fa3c03002121819cf03a801;p=gostls13.git cmd/go: use correct link flags if main package contains C++/ObjC files LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/117470043 --- diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 49ae640827..fa9262c0f0 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -1708,7 +1708,7 @@ func packInternal(b *builder, afile string, ofiles []string) error { func (gcToolchain) ld(b *builder, p *Package, out string, allactions []*action, mainpkg string, ofiles []string) error { importArgs := b.includeArgs("-L", allactions) - cxx := false + cxx := len(p.CXXFiles) > 0 for _, a := range allactions { if a.p != nil && len(a.p.CXXFiles) > 0 { cxx = true @@ -1846,8 +1846,8 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions [] ldflags := b.gccArchArgs() cgoldflags := []string{} usesCgo := false - cxx := false - objc := false + cxx := len(p.CXXFiles) > 0 + objc := len(p.MFiles) > 0 // Prefer the output of an install action to the output of a build action, // because the install action will delete the output of the build action.