Commit 131901e8 authored by Tim Wright's avatar Tim Wright Committed by Ian Lance Taylor

cmd/go, cmd/link, runtime: enable PIE build mode, cgo race tests on FreeBSD

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: 's avatarIan Lance Taylor <iant@golang.org>
parent 165ebe65
......@@ -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)
......
......@@ -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"
......
......@@ -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:
......
......@@ -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)
}
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment