]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/ld, cmd/dist: support -buildmode=c-archive on linux
authorIan Lance Taylor <iant@golang.org>
Thu, 16 Apr 2015 17:08:20 +0000 (10:08 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 17 Apr 2015 18:35:53 +0000 (18:35 +0000)
Change-Id: I8c97751a79b57197428b0f0b66fc9575708a2eb0
Reviewed-on: https://go-review.googlesource.com/8979
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/dist/test.go
src/cmd/internal/ld/lib.go

index 44f78d7c13d12e6065a954faa0e6cf54788dbd1e..8931ced14b3bfc4c35498de22c49a574c44413b1 100644 (file)
@@ -272,8 +272,7 @@ func (t *tester) registerTests() {
                } else if t.hasBash() && t.goos != "android" && !iOS {
                        t.registerTest("testso", "../misc/cgo/testso", "./test.bash")
                }
-               if t.extLink() && t.goos == "darwin" && t.goarch == "amd64" {
-                       // TODO(crawshaw): add darwin/arm{,64}
+               if t.buildmode("c-archive") {
                        t.registerTest("testcarchive", "../misc/cgo/testcarchive", "./test.bash")
                }
                if t.gohostos == "linux" && t.goarch == "amd64" {
@@ -370,6 +369,26 @@ func (t *tester) extLink() bool {
        return false
 }
 
+func (t *tester) buildmode(mode string) bool {
+       switch mode {
+       case "c-archive":
+               switch {
+               case !t.extLink():
+                       return false
+               case t.goos == "darwin" && t.goarch == "amd64":
+                       // TODO(crawshaw): add darwin/arm{,64}
+                       return true
+               case t.goos == "linux" && t.goarch == "amd64":
+                       return true
+               default:
+                       return false
+               }
+       default:
+               log.Fatal("internal error: unknown buildmode %s", mode)
+               return false
+       }
+}
+
 func (t *tester) cgoTest() error {
        env := mergeEnvLists([]string{"GOTRACEBACK=2"}, os.Environ())
 
index 390d320be2b2b5ab7b6dcab120e7a06682fd2c84..c18ae86cb5cb7ad9abc196f20dd622dbb0b912af 100644 (file)
@@ -288,7 +288,9 @@ func (mode *BuildMode) Set(s string) error {
        case "exe":
                *mode = BuildmodeExe
        case "c-archive":
-               if goos != "darwin" {
+               switch goos {
+               case "darwin", "linux":
+               default:
                        return badmode()
                }
                *mode = BuildmodeCArchive