1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:50:21 -07:00

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: d6e082707b
GitHub-Pull-Request: golang/go#24322
Reviewed-on: https://go-review.googlesource.com/99835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Kamil Rytarowski 2018-06-30 23:29:41 +00:00 committed by Brad Fitzpatrick
parent 9776d025b3
commit f5921d48f1
4 changed files with 11 additions and 4 deletions

View File

@ -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
}
}

View File

@ -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
;;

View File

@ -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

View 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 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