]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go, cmd/link, runtime: enable PIE build mode, cgo race tests on FreeBSD
authorTim Wright <tenortim@gmail.com>
Tue, 27 Mar 2018 02:00:15 +0000 (19:00 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 27 Mar 2018 02:50:29 +0000 (02:50 +0000)
Fixes #24546

Change-Id: I99ebd5bc18e5c5e42eee4689644a7a8b02405f31
Reviewed-on: https://go-review.googlesource.com/102616
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/go_test.go
src/cmd/go/internal/work/init.go
src/cmd/link/internal/ld/config.go
src/runtime/crash_cgo_test.go
src/runtime/testdata/testprogcgo/raceprof.go
src/runtime/testdata/testprogcgo/racesig.go

index d66ac20aa46e1742ed0ca6379e6b96d41ce3d432..eef6309a5df4072ae0b52a16441e306eb789e724 100644 (file)
@@ -4821,7 +4821,8 @@ func TestBuildmodePIE(t *testing.T) {
        platform := fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)
        switch platform {
        case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x",
-               "android/amd64", "android/arm", "android/arm64", "android/386":
+               "android/amd64", "android/arm", "android/arm64", "android/386",
+               "freebsd/amd64":
        case "darwin/amd64":
        default:
                t.Skipf("skipping test because buildmode=pie is not supported on %s", platform)
@@ -4836,7 +4837,7 @@ func TestBuildmodePIE(t *testing.T) {
        tg.run("build", "-buildmode=pie", "-o", obj, src)
 
        switch runtime.GOOS {
-       case "linux", "android":
+       case "linux", "android", "freebsd":
                f, err := elf.Open(obj)
                if err != nil {
                        t.Fatal(err)
index 527e81103e1035e3a574c445557d63ea093f9a11..c820e0bec07548f52e0431d4fe4087289e3069ce 100644 (file)
@@ -139,7 +139,8 @@ func buildModeInit() {
                } else {
                        switch platform {
                        case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x",
-                               "android/amd64", "android/arm", "android/arm64", "android/386":
+                               "android/amd64", "android/arm", "android/arm64", "android/386",
+                               "freebsd/amd64":
                                codegenArg = "-shared"
                        case "darwin/amd64":
                                codegenArg = "-shared"
index 302dabecb7873f023b4017923808e9cdc78666e8..a20dfd3f324e58b0cc787e9785475fd2be6bdb18 100644 (file)
@@ -39,7 +39,7 @@ func (mode *BuildMode) Set(s string) error {
        case "pie":
                switch objabi.GOOS {
                case "android", "linux":
-               case "darwin":
+               case "darwin", "freebsd":
                        switch objabi.GOARCH {
                        case "amd64":
                        default:
index 3b9fedc7a43a6182e71d01a10f6b504cbf65e07d..fc0cfd9aed18e2bdcc01fdc9c17c85dac238a5f6 100644 (file)
@@ -343,7 +343,7 @@ func TestCgoPprofThreadNoTraceback(t *testing.T) {
 }
 
 func TestRaceProf(t *testing.T) {
-       if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" {
+       if (runtime.GOOS != "linux" && runtime.GOOS != "freebsd") || runtime.GOARCH != "amd64" {
                t.Skipf("not yet supported on %s/%s", runtime.GOOS, runtime.GOARCH)
        }
 
@@ -372,7 +372,7 @@ func TestRaceProf(t *testing.T) {
 
 func TestRaceSignal(t *testing.T) {
        t.Parallel()
-       if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" {
+       if (runtime.GOOS != "linux" && runtime.GOOS != "freebsd") || runtime.GOARCH != "amd64" {
                t.Skipf("not yet supported on %s/%s", runtime.GOOS, runtime.GOARCH)
        }
 
index fe624c541fd166a8a61ca9673f18b526434ffc19..f7ca629789be7f9a44aaf33c7eafd6bfca995cb7 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux,amd64
+// +build linux,amd64 freebsd,amd64
 
 package main
 
index d0c1c3ce54004ec4f30df39e7a9b22a29d6e877d..a079b3fd1a531e4642914e916f64a5beb748b578 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build linux,amd64
+// +build linux,amd64 freebsd,amd64
 
 package main