]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime/cgo: Add initial NetBSD Thread Sanitizer support
authorKamil Rytarowski <krytarowski@users.noreply.github.com>
Sat, 30 Jun 2018 23:29:41 +0000 (23:29 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 10 Jul 2018 23:14:31 +0000 (23:14 +0000)
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/99835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/go/internal/work/init.go
src/race.bash
src/runtime/cgo/netbsd.go
src/runtime/race/race.go

index 1081e5147e06dd5f65187b52539597762211adeb..608f5648a42c1e6944f9f1c9d7914b460b464281 100644 (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
                }
        }
index 73cb1e583bc23ea0eac28445e59611c86ba394e6..d673f503a9a732eb28e570d978a1910df675d678 100755 (executable)
@@ -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
        ;;
index 2cecd0c57a36200445845e9f2efddb04cc1f6416..74d0aed014b2516ad767db59346224645eded33e 100644 (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
index f702c7a5d408b06ab10c77f26c80139cd5cd9c4d..95e965411b76da911ef598326211fc5a8ef6fb8c 100644 (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