Skip to content

Commit bce8486

Browse files
abner-chencgopherbot
authored andcommitted
cmd,runtime: enable race detector on loong64
The race feature depends on llvm. And support for building the tsan library on linux/loong64 has been added in this patch [1], which has been merged into the branch main and has landed in llvm18. The support for linux/loong64 in racebuild has been implemented in CL 655775, now racebuild can successfully build race_linux_loong64.syso [2]. [1]: llvm/llvm-project#72819 [2]: racebuild -platforms linux/loong64 -cherrypick 'refs/changes/16/543316/10' \ -rev 83fe85115da9dc25fa270d2ea8140113c8d49670 \ -goroot /home/golang/src/go Co-authored-by: Xiaolin Zhao <[email protected]> Change-Id: If389318215476890295ed771297c6c088cfc84b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/543316 Reviewed-by: Qiqi Huang <[email protected]> Reviewed-by: Junyang Shao <[email protected]> Auto-Submit: Michael Pratt <[email protected]> Reviewed-by: Meidan Li <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Mauri de Souza Meneguzzo <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Reviewed-by: sophie zhao <[email protected]>
1 parent 86101b0 commit bce8486

File tree

8 files changed

+532
-4
lines changed

8 files changed

+532
-4
lines changed

src/cmd/dist/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,7 @@ func (t *tester) makeGOROOTUnwritable() (undo func()) {
16781678
func raceDetectorSupported(goos, goarch string) bool {
16791679
switch goos {
16801680
case "linux":
1681-
return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64" || goarch == "s390x"
1681+
return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64" || goarch == "s390x" || goarch == "loong64"
16821682
case "darwin":
16831683
return goarch == "amd64" || goarch == "arm64"
16841684
case "freebsd", "netbsd", "windows":

src/internal/platform/supported.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (p OSArch) String() string {
2323
func RaceDetectorSupported(goos, goarch string) bool {
2424
switch goos {
2525
case "linux":
26-
return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64" || goarch == "s390x"
26+
return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64" || goarch == "s390x" || goarch == "loong64"
2727
case "darwin":
2828
return goarch == "amd64" || goarch == "arm64"
2929
case "freebsd", "netbsd", "windows":

src/race.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
set -e
1010

1111
function usage {
12-
echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, linux/s390x, freebsd/amd64, netbsd/amd64, openbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
12+
echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, linux/loong64, linux/s390x, freebsd/amd64, netbsd/amd64, openbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
1313
exit 1
1414
}
1515

@@ -19,6 +19,7 @@ case $(uname -s -m) in
1919
"Linux x86_64") ;;
2020
"Linux ppc64le") ;;
2121
"Linux aarch64") ;;
22+
"Linux loongarch64") ;;
2223
"Linux s390x") ;;
2324
"FreeBSD amd64") ;;
2425
"NetBSD amd64") ;;

src/runtime/asm_loong64.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
3737
JAL (R25)
3838

3939
nocgo:
40+
JAL runtime·save_g(SB)
4041
// update stackguard after _cgo_init
4142
MOVV (g_stack+stack_lo)(g), R19
4243
ADDV $const_stackGuard, R19

src/runtime/race/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ internal/amd64v1/race_windows.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d
1313
internal/amd64v3/race_linux.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
1414
race_darwin_arm64.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
1515
race_linux_arm64.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
16+
race_linux_loong64.syso built with LLVM 83fe85115da9dc25fa270d2ea8140113c8d49670 and Go 037112464b4439571b45536de9ebe4bc9e10ecb7.
1617
race_linux_ppc64le.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.
1718
race_linux_s390x.syso built with LLVM 51bfeff0e4b0757ff773da6882f4d538996c9b04 and Go e7d582b55dda36e76ce4d0ce770139ca0915b7c5.

src/runtime/race/race.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build race && ((linux && (amd64 || arm64 || ppc64le || s390x)) || ((freebsd || netbsd || openbsd || windows) && amd64))
5+
//go:build race && ((linux && (amd64 || arm64 || loong64 || ppc64le || s390x)) || ((freebsd || netbsd || openbsd || windows) && amd64))
66

77
package race
88

647 KB
Binary file not shown.

0 commit comments

Comments
 (0)