Commit f5921d48 authored by Kamil Rytarowski's avatar Kamil Rytarowski Committed by Brad Fitzpatrick

runtime/cgo: Add initial NetBSD Thread Sanitizer support

Recognize NetBSD in:
 - go/internal/work/init.go
 - race.bash
 - runtime/race/race.go

Add __ps_strings symbol in runtime/cgo/netbsd.go as this is
used internally in the TSan library for NetBSD and used for
ReExec().

Tested on NetBSD/amd64 v. 8.99.12.

Around 98% tests are passing for the ./race.bash target.

Updates #19273

Change-Id: Ic0e48d2fb159a7868aab5e17156eeaca1225e513
GitHub-Last-Rev: d6e082707b9b18df1fe63f723666f4d2eb5e6cfe
GitHub-Pull-Request: golang/go#24322
Reviewed-on: https://go-review.googlesource.com/99835Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 9776d025
......@@ -47,9 +47,9 @@ func instrumentInit() {
platform := cfg.Goos + "/" + cfg.Goarch
switch platform {
default:
fmt.Fprintf(os.Stderr, "go %s: -race is only supported on linux/amd64, linux/ppc64le, freebsd/amd64, darwin/amd64 and windows/amd64\n", flag.Args()[0])
fmt.Fprintf(os.Stderr, "go %s: -race is only supported on linux/amd64, linux/ppc64le, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64\n", flag.Args()[0])
os.Exit(2)
case "linux/amd64", "linux/ppc64le", "freebsd/amd64", "darwin/amd64", "windows/amd64":
case "linux/amd64", "linux/ppc64le", "freebsd/amd64", "netbsd/amd64", "darwin/amd64", "windows/amd64":
// race supported on these platforms
}
}
......
......@@ -9,7 +9,7 @@
set -e
function usage {
echo 'race detector is only supported on linux/amd64, linux/ppc64le, freebsd/amd64 and darwin/amd64' 1>&2
echo 'race detector is only supported on linux/amd64, linux/ppc64le, freebsd/amd64, netbsd/amd64 and darwin/amd64' 1>&2
exit 1
}
......@@ -30,6 +30,11 @@ case $(uname) in
usage
fi
;;
"NetBSD")
if [ $(uname -m) != "amd64" ]; then
usage
fi
;;
*)
usage
;;
......
......@@ -14,6 +14,8 @@ import _ "unsafe" // for go:linkname
//go:linkname _environ environ
//go:linkname _progname __progname
//go:linkname ___ps_strings __ps_strings
var _environ uintptr
var _progname uintptr
var ___ps_strings uintptr
......@@ -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 race,linux,amd64 race,freebsd,amd64 race,darwin,amd64 race,windows,amd64 race,linux,ppc64le
// +build race,linux,amd64 race,freebsd,amd64 race,netbsd,amd64 race,darwin,amd64 race,windows,amd64 race,linux,ppc64le
package race
......
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