Skip to content

runtime/cgo: Add initial NetBSD Thread Sanitizer support #24322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cmd/go/internal/work/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/race.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -30,6 +30,11 @@ case $(uname) in
usage
fi
;;
"NetBSD")
if [ $(uname -m) != "amd64" ]; then
usage
fi
;;
*)
usage
;;
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/cgo/netbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion src/runtime/race/race.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 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

Expand Down