Hello! This is the second version of my patch to add support for SuperH in libgo. The changes over my first patch in [1] are:
* account for little- and big-endian targets * account for sh3- and sh4-specific parameters I have not added support for SH-1 and SH-2 targets for now as most Linux distributions with SH support usually target sh3 and sh4 only. I have already signed the Google CLA in the past when I contributed a small patch to Kubernetes. Thanks, Adrian > [1] https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01111.html -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
>From ce83430f1a8d34f005f46208e4c8ab22ad00c879 Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> Date: Sat, 16 Dec 2017 10:05:20 +0100 Subject: [PATCH] 2017-12-17 John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> PR go/83308 * libgo/configure.ac: Add support for sh3, sh3be, sh4, sh4be. * libgo/go/go/build/syslist.go: Add sh3, sh3be, sh4, sh4be to goarchList. * libgo/go/cmd/cgo/main.go: Enable build on sh3, sh3be, sh4, sh4be. * libgo/go/runtime/hash32.go: Likewise. * libgo/go/runtime/lfstack_32bit.go: Likewise. * libgo/go/runtime/unaligned2.go: Likewise. * libgo/go/syscall/endian_big.go: Enable build on sh3be, sh4be. * libgo/go/syscall/endian_little.go: Enable build on sh3, sh4. * libgo/match.sh: Add architecture matching for sh3, sh3be, sh4, sh4be. * libgo/testsuite/gotest: Likewise. --- ChangeLog | 14 ++++++++++++++ libgo/configure.ac | 34 ++++++++++++++++++++++++++++++++-- libgo/go/cmd/cgo/main.go | 8 ++++++++ libgo/go/go/build/syslist.go | 2 +- libgo/go/runtime/hash32.go | 2 +- libgo/go/runtime/lfstack_32bit.go | 2 +- libgo/go/runtime/unaligned2.go | 2 +- libgo/go/syscall/endian_big.go | 2 +- libgo/go/syscall/endian_little.go | 2 +- libgo/match.sh | 4 ++-- libgo/testsuite/gotest | 4 ++-- 11 files changed, 64 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 275a340f6a8..18c3cfe0743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2017-12-17 John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> + + PR go/83308 + * libgo/configure.ac: Add support for sh3, sh3be, sh4, sh4be. + * libgo/go/go/build/syslist.go: Add sh3, sh3be, sh4, sh4be to goarchList. + * libgo/go/cmd/cgo/main.go: Enable build on sh3, sh3be, sh4, sh4be. + * libgo/go/runtime/hash32.go: Likewise. + * libgo/go/runtime/lfstack_32bit.go: Likewise. + * libgo/go/runtime/unaligned2.go: Likewise. + * libgo/go/syscall/endian_big.go: Enable build on sh3be, sh4be. + * libgo/go/syscall/endian_little.go: Enable build on sh3, sh4. + * libgo/match.sh: Add architecture matching for sh3, sh3be, sh4, sh4be. + * libgo/testsuite/gotest: Likewise. + 2017-12-12 Stafford Horne <sho...@gmail.com> * configure.ac: Remove logic adding gdb to noconfigsdirs for or1k. diff --git a/libgo/configure.ac b/libgo/configure.ac index 7b0c629653f..63cd857c23f 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -208,10 +208,10 @@ AC_SUBST(USE_DEJAGNU) # supported by the gofrontend and all architectures supported by the # gc toolchain. # N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch). -ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sparc sparc64" +ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le ppc ppc64 ppc64le s390 s390x sh3 sh3be sh4 sh4be sparc sparc64" # All known GOARCH_FAMILY values. -ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SPARC SPARC64" +ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SH SPARC SPARC64" GOARCH=unknown GOARCH_FAMILY=unknown @@ -360,6 +360,36 @@ GOARCH_MINFRAMESIZE=8 GOARCH_CACHELINESIZE=256 GOARCH_PCQUANTUM=2 ;; + sh3eb*-*-*) + GOARCH=sh3be + GOARCH_FAMILY=SH + GOARCH_BIGENDIAN=1 + GOARCH_CACHELINESIZE=16 + GOARCH_PCQUANTUM=2 + GOARCH_MINFRAMESIZE=4 + ;; + sh3*-*-*) + GOARCH=sh3 + GOARCH_FAMILY=SH + GOARCH_CACHELINESIZE=16 + GOARCH_PCQUANTUM=2 + GOARCH_MINFRAMESIZE=4 + ;; + sh4eb*-*-*) + GOARCH=sh4be + GOARCH_FAMILY=SH + GOARCH_BIGENDIAN=1 + GOARCH_CACHELINESIZE=32 + GOARCH_PCQUANTUM=2 + GOARCH_MINFRAMESIZE=4 + ;; + sh4*-*-*) + GOARCH=sh4 + GOARCH_FAMILY=SH + GOARCH_CACHELINESIZE=32 + GOARCH_PCQUANTUM=2 + GOARCH_MINFRAMESIZE=4 + ;; sparc*-*-*) AC_COMPILE_IFELSE([ #if defined(__sparcv9) || defined(__arch64__) diff --git a/libgo/go/cmd/cgo/main.go b/libgo/go/cmd/cgo/main.go index c9a44fdd166..a45283e7fa0 100644 --- a/libgo/go/cmd/cgo/main.go +++ b/libgo/go/cmd/cgo/main.go @@ -161,6 +161,10 @@ var ptrSizeMap = map[string]int64{ "ppc64le": 8, "s390": 4, "s390x": 8, + "sh3": 4, + "sh3be": 4, + "sh4": 4, + "sh4be": 4, "sparc": 4, "sparc64": 8, } @@ -183,6 +187,10 @@ var intSizeMap = map[string]int64{ "ppc64le": 8, "s390": 4, "s390x": 8, + "sh3": 4, + "sh3be": 4, + "sh4": 4, + "sh4be": 4, "sparc": 4, "sparc64": 8, } diff --git a/libgo/go/go/build/syslist.go b/libgo/go/go/build/syslist.go index 290ba9efa0c..6c916f2ea6e 100644 --- a/libgo/go/go/build/syslist.go +++ b/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 sparc sparc64 " +const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be alpha m68k ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sh3 sh3be sh4 sh4be sparc sparc64 " diff --git a/libgo/go/runtime/hash32.go b/libgo/go/runtime/hash32.go index dd2e657fe3f..4e0cd1085f0 100644 --- a/libgo/go/runtime/hash32.go +++ b/libgo/go/runtime/hash32.go @@ -6,7 +6,7 @@ // xxhash: https://code.google.com/p/xxhash/ // cityhash: https://code.google.com/p/cityhash/ -// +build 386 arm armbe m68k mips mipsle ppc s390 sparc +// +build 386 arm armbe m68k mips mipsle ppc s390 sh3 sh3be sh4 sh4be sparc package runtime diff --git a/libgo/go/runtime/lfstack_32bit.go b/libgo/go/runtime/lfstack_32bit.go index ab0edab68f5..1520cac0917 100644 --- a/libgo/go/runtime/lfstack_32bit.go +++ b/libgo/go/runtime/lfstack_32bit.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 arm nacl armbe m68k mips mipsle mips64p32 mips64p32le ppc s390 sparc +// +build 386 arm nacl armbe m68k mips mipsle mips64p32 mips64p32le ppc s390 sh3 sh3be sh4 sh4be sparc package runtime diff --git a/libgo/go/runtime/unaligned2.go b/libgo/go/runtime/unaligned2.go index a33c87acd56..34de3bb0e82 100644 --- a/libgo/go/runtime/unaligned2.go +++ b/libgo/go/runtime/unaligned2.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 arm mips mipsle mips64 mips64le armbe m68k sparc alpha ia64 mips64p32 mips64p32le sparc64 +// +build arm mips mipsle mips64 mips64le armbe m68k sparc alpha ia64 mips64p32 mips64p32le sh3 sh3be sh4 sh4be sparc64 package runtime diff --git a/libgo/go/syscall/endian_big.go b/libgo/go/syscall/endian_big.go index f8ee7cfc233..58f6347423d 100644 --- a/libgo/go/syscall/endian_big.go +++ b/libgo/go/syscall/endian_big.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 ppc64 s390x mips mips64 armbe arm64be m68k ppc mips64p32 s390 sparc sparc64 +// +build ppc64 s390x mips mips64 armbe arm64be m68k ppc mips64p32 s390 sh3be sh4be sparc sparc64 package syscall diff --git a/libgo/go/syscall/endian_little.go b/libgo/go/syscall/endian_little.go index b6c9ed0f9f7..373d73f6768 100644 --- a/libgo/go/syscall/endian_little.go +++ b/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 +// +build 386 amd64 amd64p32 arm arm64 ppc64le mips64le mipsle alpha ia64 mips64p32le sh3 sh4 package syscall diff --git a/libgo/match.sh b/libgo/match.sh index fac75eabec6..4dcf45b6a38 100755 --- a/libgo/match.sh +++ b/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 | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh3 | sh3be | sh4 | sh4be | 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 | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh3 | sh3be | sh4 | sh4be | sparc | sparc64) tag2=nonmatchingtag ;; esac diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest index 83f78d4d9b9..d3950bc3d9e 100755 --- a/libgo/testsuite/gotest +++ b/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 | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh3 | sh3be | sh4 | sh4be | 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 | sparc | sparc64) + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | ppc | s390 | s390x | sh3 | sh3be | sh4 | sh4be | sparc | sparc64) tag2=nonmatchingtag ;; esac -- 2.15.1