From 393f2bb067088cdbdb8d5848e6880b2ce65ddaf9 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 19 May 2020 18:56:01 +1000 Subject: cmd/dist,cmd/go,runtime: add support for cgo on linux/riscv64 Fixes #36641 Change-Id: I51868d83ce341d78d33b221d184c5a5110c60d14 Reviewed-on: https://go-review.googlesource.com/c/go/+/263598 Trust: Joel Sing Run-TryBot: Joel Sing TryBot-Result: Go Bot Reviewed-by: Cherry Zhang --- src/cmd/dist/build.go | 2 +- src/cmd/dist/test.go | 6 +++--- src/cmd/go/testdata/script/build_plugin_non_main.txt | 3 ++- src/cmd/nm/nm_cgo_test.go | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/cmd') diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index d822a83e44..20cb04d797 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1549,7 +1549,7 @@ var cgoEnabled = map[string]bool{ "linux/mipsle": true, "linux/mips64": true, "linux/mips64le": true, - "linux/riscv64": false, // Issue 36641 + "linux/riscv64": true, "linux/s390x": true, "linux/sparc64": true, "android/386": true, diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 9c25392cc0..d12a52b1cc 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -953,7 +953,7 @@ func (t *tester) internalLink() bool { // Internally linking cgo is incomplete on some architectures. // https://golang.org/issue/10373 // https://golang.org/issue/14449 - if goarch == "mips64" || goarch == "mips64le" || goarch == "mips" || goarch == "mipsle" { + if goarch == "mips64" || goarch == "mips64le" || goarch == "mips" || goarch == "mipsle" || goarch == "riscv64" { return false } if goos == "aix" { @@ -1117,8 +1117,8 @@ func (t *tester) cgoTest(dt *distTest) error { "android-arm", "android-arm64", "dragonfly-amd64", "freebsd-386", "freebsd-amd64", "freebsd-arm", - "linux-386", "linux-amd64", "linux-arm", "linux-ppc64le", "linux-s390x", - "netbsd-386", "netbsd-amd64", "linux-arm64": + "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-riscv64", "linux-s390x", + "netbsd-386", "netbsd-amd64": cmd := t.addCmd(dt, "misc/cgo/test", t.goTest()) cmd.Env = append(os.Environ(), "GOFLAGS=-ldflags=-linkmode=external") diff --git a/src/cmd/go/testdata/script/build_plugin_non_main.txt b/src/cmd/go/testdata/script/build_plugin_non_main.txt index dba80c29ad..3c82dced73 100644 --- a/src/cmd/go/testdata/script/build_plugin_non_main.txt +++ b/src/cmd/go/testdata/script/build_plugin_non_main.txt @@ -1,5 +1,6 @@ -# Plugins are only supported on linux,cgo and darwin,cgo. +# Plugins are only supported on linux,cgo (!riscv64) and darwin,cgo. [!linux] [!darwin] skip +[linux] [riscv64] skip [!cgo] skip go build -n testdep diff --git a/src/cmd/nm/nm_cgo_test.go b/src/cmd/nm/nm_cgo_test.go index 9a257e0ed2..e0414e6b22 100644 --- a/src/cmd/nm/nm_cgo_test.go +++ b/src/cmd/nm/nm_cgo_test.go @@ -24,7 +24,7 @@ func canInternalLink() bool { } case "linux": switch runtime.GOARCH { - case "arm64", "mips64", "mips64le", "mips", "mipsle", "ppc64", "ppc64le": + case "arm64", "mips64", "mips64le", "mips", "mipsle", "ppc64", "ppc64le", "riscv64": return false } case "openbsd": -- cgit v1.3