]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: enable race detector on openbsd/amd64
authorJoel Sing <joel@sing.id.au>
Mon, 7 Dec 2020 17:14:34 +0000 (04:14 +1100)
committerJoel Sing <joel@sing.id.au>
Tue, 23 Feb 2021 12:14:32 +0000 (12:14 +0000)
Now that this commit[1] has landed in LLVM the .syso file can be generated for
OpenBSD.

With the changes to src/runtime running the sample race[2] detects the data
race as expected.

Based on golang/go#39464 (https://go-review.googlesource.com/c/go/+/237057) from
Aaron Bieber <deftly@gmail.com>, however the race_openbsd_amd64.syso file has
been built on OpenBSD 6.4 and necessary changes added to race.bash.

[1] https://github.com/llvm/llvm-project/commit/fcf6ae2f070eba73074b6ec8d8281e54d29dbeeb
[2] https://golang.org/doc/articles/race_detector.html

Change-Id: Ic2479ccfa91d6b2cb4585346a11d813d96450f68
Reviewed-on: https://go-review.googlesource.com/c/go/+/275892
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/dist/test.go
src/cmd/internal/sys/supported.go
src/race.bash
src/runtime/race/README
src/runtime/race/race.go
src/runtime/race/race_openbsd_amd64.syso [new file with mode: 0644]

index a22397aa16b298f9a0934fb82aeb235e573025b6..0c8e2c56bc3d23b07025c35b1a74a7bddfd442c0 100644 (file)
@@ -1633,7 +1633,7 @@ func raceDetectorSupported(goos, goarch string) bool {
                return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
        case "darwin":
                return goarch == "amd64" || goarch == "arm64"
-       case "freebsd", "netbsd", "windows":
+       case "freebsd", "netbsd", "openbsd", "windows":
                return goarch == "amd64"
        default:
                return false
index ef7c017bd4abb37ba517dafdc2fd4f53193af97d..291acf086203a334f224ddac395a375705971002 100644 (file)
@@ -15,7 +15,7 @@ func RaceDetectorSupported(goos, goarch string) bool {
                return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
        case "darwin":
                return goarch == "amd64" || goarch == "arm64"
-       case "freebsd", "netbsd", "windows":
+       case "freebsd", "netbsd", "openbsd", "windows":
                return goarch == "amd64"
        default:
                return false
index e2b96bcffefe0d24f0e4250f7854c8a88e0fa3b8..81fb4be60646b70cc0b7541beb82695d673a25e8 100755 (executable)
@@ -9,7 +9,7 @@
 set -e
 
 function usage {
-       echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
+       echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, openbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
        exit 1
 }
 
@@ -34,6 +34,11 @@ case $(uname) in
                usage
        fi
        ;;
+"OpenBSD")
+       if [ $(uname -m) != "amd64" ]; then
+               usage
+       fi
+       ;;
 *)
        usage
        ;;
index 178ab94ab571d6a011aaaf1f3ea1ba7f0f025c7c..dbff42dc8a0464c11c667a67a7d3b2bd17734927 100644 (file)
@@ -12,3 +12,4 @@ race_netbsd_amd64.syso built with LLVM 89f7ccea6f6488c443655880229c54db1f180153
 race_windows_amd64.syso built with LLVM 89f7ccea6f6488c443655880229c54db1f180153 and Go f62d3202bf9dbb3a00ad2a2c63ff4fa4188c5d3b.
 race_linux_arm64.syso built with LLVM 89f7ccea6f6488c443655880229c54db1f180153 and Go f62d3202bf9dbb3a00ad2a2c63ff4fa4188c5d3b.
 race_darwin_arm64.syso built with LLVM 00da38ce2d36c07f12c287dc515d37bb7bc410e9 and Go fe70a3a0fd31441bcbb9932ecab11a6083cf2119.
+race_openbsd_amd64.syso built with LLVM fcf6ae2f070eba73074b6ec8d8281e54d29dbeeb and Go 8f2db14cd35bbd674cb2988a508306de6655e425.
index fe50900ec8bcb3854bbe1687c285692cbc57d0cc..84050e877111818583a9ac4d074989418a7ef2a5 100644 (file)
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build (race && linux && amd64) || (race && freebsd && amd64) || (race && netbsd && amd64) || (race && darwin && amd64) || (race && windows && amd64) || (race && linux && ppc64le) || (race && linux && arm64) || (race && darwin && arm64)
-// +build race,linux,amd64 race,freebsd,amd64 race,netbsd,amd64 race,darwin,amd64 race,windows,amd64 race,linux,ppc64le race,linux,arm64 race,darwin,arm64
+//go:build (race && linux && amd64) || (race && freebsd && amd64) || (race && netbsd && amd64) || (race && darwin && amd64) || (race && windows && amd64) || (race && linux && ppc64le) || (race && linux && arm64) || (race && darwin && arm64) || (race && openbsd && amd64)
+// +build race,linux,amd64 race,freebsd,amd64 race,netbsd,amd64 race,darwin,amd64 race,windows,amd64 race,linux,ppc64le race,linux,arm64 race,darwin,arm64 race,openbsd,amd64
 
 package race
 
diff --git a/src/runtime/race/race_openbsd_amd64.syso b/src/runtime/race/race_openbsd_amd64.syso
new file mode 100644 (file)
index 0000000..9fefd87
Binary files /dev/null and b/src/runtime/race/race_openbsd_amd64.syso differ