]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: unify internal linking checks
authorDavid Crawshaw <crawshaw@golang.org>
Fri, 16 Sep 2016 22:25:52 +0000 (18:25 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 16 Sep 2016 22:38:53 +0000 (22:38 +0000)
I missed one in CL 29360.

Change-Id: I29fc6dcd920829a918c70734d646119133a0a9df
Reviewed-on: https://go-review.googlesource.com/29361
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/dist/test.go

index b56289d854ec260311dd654dc599757cb750dfb9..2c114be93ffdae03726bb5f67a4d0ee201ecda96 100644 (file)
@@ -409,9 +409,7 @@ func (t *tester) registerTests() {
        // release on a system that does not have a C compiler
        // installed and still build Go programs (that don't use cgo).
        for _, pkg := range cgoPackages {
-
-               // Internal linking is not currently supported on Dragonfly.
-               if t.goos == "dragonfly" {
+               if !t.internalLink() {
                        break
                }
 
@@ -420,13 +418,6 @@ func (t *tester) registerTests() {
                        break
                }
 
-               // Internally linking cgo is incomplete on some architectures.
-               // https://golang.org/issue/10373
-               // https://golang.org/issue/14449
-               if t.goarch == "arm64" || t.goarch == "mips64" {
-                       break
-               }
-
                pkg := pkg
                var run string
                if pkg == "net" {
@@ -702,6 +693,31 @@ func (t *tester) extLink() bool {
        return false
 }
 
+func (t *tester) internalLink() bool {
+       if t.gohostos == "dragonfly" {
+               // linkmode=internal fails on dragonfly since errno is a TLS relocation.
+               return false
+       }
+       if t.gohostarch == "ppc64le" {
+               // linkmode=internal fails on ppc64le because cmd/link doesn't
+               // handle the TOC correctly (issue 15409).
+               return false
+       }
+       if t.goos == "android" {
+               return false
+       }
+       if t.goos == "darwin" && (t.goarch == "arm" || t.goarch == "arm64") {
+               return false
+       }
+       // Internally linking cgo is incomplete on some architectures.
+       // https://golang.org/issue/10373
+       // https://golang.org/issue/14449
+       if t.goarch == "arm64" || t.goarch == "mips64" {
+               return false
+       }
+       return true
+}
+
 func (t *tester) supportedBuildmode(mode string) bool {
        pair := t.goos + "-" + t.goarch
        switch mode {
@@ -769,10 +785,7 @@ func (t *tester) cgoTest(dt *distTest) error {
        cmd := t.addCmd(dt, "misc/cgo/test", "go", "test", t.tags(), "-ldflags", "-linkmode=auto", t.runFlag(""))
        cmd.Env = env
 
-       if t.gohostos != "dragonfly" && t.gohostarch != "ppc64le" && t.goos != "android" && (t.goos != "darwin" || t.goarch != "arm") {
-               // linkmode=internal fails on dragonfly since errno is a TLS relocation.
-               // linkmode=internal fails on ppc64le because cmd/link doesn't
-               // handle the TOC correctly (issue 15409).
+       if t.internalLink() {
                cmd := t.addCmd(dt, "misc/cgo/test", "go", "test", "-ldflags", "-linkmode=internal", t.runFlag(""))
                cmd.Env = env
        }