1
0
mirror of https://github.com/golang/go synced 2024-11-14 23:20:27 -07:00
go/src/race.bash
Fangming.Fang 978cfa8e46 cmd,runtime: enable race detector on arm64
Changes include:
1. enable compiler option -race for arm64
2. add runtime/race_arm64.s to manage the calls from Go to the compiler-rt runtime
3. change racewalk.go to call racefuncenterfp instead of racefuncenter on arm64 to
   allow the caller pc to be obtained in the asm code before calling the tsan version
4. race_linux_arm64.syso comes from compiler-rt which just supports 48bit VA, compiler-rt
   is fetched from master branch which latest commit is 3aa2b775d08f903f804246af10b

Fixes #25682

Change-Id: I04364c580b8157fd117deecae74a4656ba16e005
Reviewed-on: https://go-review.googlesource.com/c/138675
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-11-13 16:57:22 +00:00

50 lines
1021 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2013 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# race.bash tests the standard library under the race detector.
# https://golang.org/doc/articles/race_detector.html
set -e
function usage {
echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64 and darwin/amd64' 1>&2
exit 1
}
case $(uname) in
"Darwin")
# why Apple? why?
if sysctl machdep.cpu.extfeatures | grep -qv EM64T; then
usage
fi
;;
"Linux")
if [ $(uname -m) != "x86_64" ] && [ $(uname -m) != "ppc64le" ] && [ $(uname -m) != "aarch64" ]; then
usage
fi
;;
"FreeBSD")
if [ $(uname -m) != "amd64" ]; then
usage
fi
;;
"NetBSD")
if [ $(uname -m) != "amd64" ]; then
usage
fi
;;
*)
usage
;;
esac
if [ ! -f make.bash ]; then
echo 'race.bash must be run from $GOROOT/src' 1>&2
exit 1
fi
. ./make.bash --no-banner
go install -race std
go tool dist test -race