Index: gcc-8.0.1+r257516/libgo/configure.ac =================================================================== --- gcc-8.0.1+r257516.orig/libgo/configure.ac +++ gcc-8.0.1+r257516/libgo/configure.ac @@ -224,10 +224,10 @@ AC_SUBST(USE_DEJAGNU) # - libgo/go/syscall/endian_XX.go # - possibly others # - possibly update files in libgo/go/internal/syscall/unix -ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sh shbe sparc sparc64" +ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le riscv64 s390 s390x sh shbe sparc sparc64" # All known GOARCH family values. -ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SH SPARC SPARC64" +ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 RISCV64 S390 S390X SH SPARC SPARC64" GOARCH=unknown case ${host} in @@ -304,6 +304,9 @@ AC_COMPILE_IFELSE([ [GOARCH=ppc64le], [GOARCH=ppc64])]) ;; + riscv64-*-*) + GOARCH=riscv64 + ;; s390*-*-*) AC_COMPILE_IFELSE([ #if defined(__s390x__) @@ -500,7 +503,8 @@ AC_COMPILE_IFELSE([[int i;]], CFLAGS=$CFLAGS_hold]) PTHREAD_CFLAGS= if test "$libgo_cv_lib_pthread" = yes; then - PTHREAD_CFLAGS=-pthread + # RISC-V apparently adds -latomic when using -pthread. + PTHREAD_CFLAGS="-pthread -L../libatomic/.libs" fi AC_SUBST(PTHREAD_CFLAGS) Index: gcc-8.0.1+r257516/libgo/go/cmd/cgo/main.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/cmd/cgo/main.go +++ gcc-8.0.1+r257516/libgo/go/cmd/cgo/main.go @@ -168,6 +168,7 @@ var ptrSizeMap = map[string]int64{ "ppc": 4, "ppc64": 8, "ppc64le": 8, + "riscv64": 8, "s390": 4, "s390x": 8, "sh": 4, @@ -192,6 +193,7 @@ var intSizeMap = map[string]int64{ "ppc": 4, "ppc64": 8, "ppc64le": 8, + "riscv64": 8, "s390": 4, "s390x": 8, "sh": 4, Index: gcc-8.0.1+r257516/libgo/go/go/build/syslist.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/go/build/syslist.go +++ gcc-8.0.1+r257516/libgo/go/go/build/syslist.go @@ -5,4 +5,4 @@ package build const goosList = "aix android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows zos " -const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be alpha m68k ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sh shbe sparc sparc64" +const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be alpha m68k ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv64 s390 s390x sh shbe sparc sparc64" Index: gcc-8.0.1+r257516/libgo/go/internal/syscall/unix/getrandom_linux_generic.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/internal/syscall/unix/getrandom_linux_generic.go +++ gcc-8.0.1+r257516/libgo/go/internal/syscall/unix/getrandom_linux_generic.go @@ -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 arm64 +// +build arm64 riscv64 package unix Index: gcc-8.0.1+r257516/libgo/go/runtime/hash64.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/runtime/hash64.go +++ gcc-8.0.1+r257516/libgo/go/runtime/hash64.go @@ -6,7 +6,7 @@ // xxhash: https://code.google.com/p/xxhash/ // cityhash: https://code.google.com/p/cityhash/ -// +build amd64 amd64p32 arm64 mips64 mips64le ppc64 ppc64le s390x alpha arm64be ia64 mips64p32 mips64p32le sparc64 +// +build amd64 amd64p32 arm64 mips64 mips64le ppc64 ppc64le s390x alpha arm64be ia64 mips64p32 mips64p32le sparc64 riscv64 package runtime Index: gcc-8.0.1+r257516/libgo/go/runtime/lfstack_64bit.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/runtime/lfstack_64bit.go +++ gcc-8.0.1+r257516/libgo/go/runtime/lfstack_64bit.go @@ -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 amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha sparc64 ia64 +// +build amd64 arm64 mips64 mips64le ppc64 ppc64le s390x arm64be alpha sparc64 ia64 riscv64 package runtime Index: gcc-8.0.1+r257516/libgo/go/runtime/unaligned1.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/runtime/unaligned1.go +++ gcc-8.0.1+r257516/libgo/go/runtime/unaligned1.go @@ -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 386 amd64 amd64p32 arm64 ppc64 ppc64le s390x ppc s390 arm64be +// +build 386 amd64 amd64p32 arm64 ppc64 ppc64le s390x ppc s390 arm64be riscv64 package runtime Index: gcc-8.0.1+r257516/libgo/go/syscall/endian_little.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/syscall/endian_little.go +++ gcc-8.0.1+r257516/libgo/go/syscall/endian_little.go @@ -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 386 amd64 amd64p32 arm arm64 ppc64le mips64le mipsle alpha ia64 mips64p32le sh +// +build 386 amd64 amd64p32 arm arm64 ppc64le mips64le mipsle alpha ia64 mips64p32le sh riscv64 package syscall Index: gcc-8.0.1+r257516/libgo/go/syscall/libcall_linux_ustat.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/go/syscall/libcall_linux_ustat.go +++ gcc-8.0.1+r257516/libgo/go/syscall/libcall_linux_ustat.go @@ -4,7 +4,7 @@ // GNU/Linux library ustat call. // This is not supported on some kernels, such as arm64. -// +build !arm64 +// +build !arm64,!riscv64 package syscall Index: gcc-8.0.1+r257516/libgo/goarch.sh =================================================================== --- gcc-8.0.1+r257516.orig/libgo/goarch.sh +++ gcc-8.0.1+r257516/libgo/goarch.sh @@ -146,6 +146,10 @@ case $goarch in ;; esac ;; + riscv64) + family=RISCV64 + pcquantum=2 + ;; s390) family=S390 bigendian=true Index: gcc-8.0.1+r257516/libgo/match.sh =================================================================== --- gcc-8.0.1+r257516.orig/libgo/match.sh +++ gcc-8.0.1+r257516/libgo/match.sh @@ -116,7 +116,7 @@ for f in $gofiles; do aix | android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) tag1=nonmatchingtag ;; - 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh | shbe | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64) tag1=nonmatchingtag ;; esac @@ -128,7 +128,7 @@ for f in $gofiles; do aix | android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) tag2=nonmatchingtag ;; - 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh | shbe | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64) tag2=nonmatchingtag ;; esac Index: gcc-8.0.1+r257516/libgo/misc/cgo/testcshared/src/libgo2/dup2.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/misc/cgo/testcshared/src/libgo2/dup2.go +++ gcc-8.0.1+r257516/libgo/misc/cgo/testcshared/src/libgo2/dup2.go @@ -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 darwin dragonfly freebsd linux,!arm64 netbsd openbsd +// +build darwin dragonfly freebsd linux,!arm64,!riscv64 netbsd openbsd package main Index: gcc-8.0.1+r257516/libgo/misc/cgo/testcshared/src/libgo2/dup3.go =================================================================== --- gcc-8.0.1+r257516.orig/libgo/misc/cgo/testcshared/src/libgo2/dup3.go +++ gcc-8.0.1+r257516/libgo/misc/cgo/testcshared/src/libgo2/dup3.go @@ -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 linux,arm64 +// +build linux,arm64 linux,riscv64 package main Index: gcc-8.0.1+r257516/libgo/testsuite/gotest =================================================================== --- gcc-8.0.1+r257516.orig/libgo/testsuite/gotest +++ gcc-8.0.1+r257516/libgo/testsuite/gotest @@ -314,7 +314,7 @@ x) aix | android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) tag1=nonmatchingtag ;; - 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh | shbe | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64) tag1=nonmatchingtag ;; esac @@ -326,7 +326,7 @@ x) aix | android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) tag2=nonmatchingtag ;; - 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh | shbe | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64) tag2=nonmatchingtag ;; esac Index: gcc-8.0.1+r257516/gcc/testsuite/go.test/go-test.exp =================================================================== --- gcc-8.0.1+r257516.orig/gcc/testsuite/go.test/go-test.exp +++ gcc-8.0.1+r257516/gcc/testsuite/go.test/go-test.exp @@ -246,6 +246,9 @@ proc go-set-goarch { } { } } } + "riscv64-*-*" { + set goarch "riscv64" + } "s390*-*-*" { if [check_effective_target_ilp32] { set goarch "s390"