Skip to content

Commit

Permalink
cmd/go, cmd/link, runtime: enable PIE build mode, cgo race tests on F…
Browse files Browse the repository at this point in the history
…reeBSD

Fixes golang#24546

Change-Id: I99ebd5bc18e5c5e42eee4689644a7a8b02405f31
Reviewed-on: https://go-review.googlesource.com/102616
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
tenortim authored and ianlancetaylor committed Mar 27, 2018
1 parent 165ebe6 commit 131901e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/cmd/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/go/internal/work/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/link/internal/ld/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/crash_cgo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/testdata/testprogcgo/raceprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/testdata/testprogcgo/racesig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 131901e

Please sign in to comment.