libgo: add hppa as known target
Checks
Commit Message
Test results: This is sufficient to get a build that can compile
trivial hello world programs. Nontrivial operations (like "go install")
crash in the runtime. However, GOGC=off completely avoids these crashes
and is able to compile more complex libraries, so likely a GC issue.
Support needs to be added to /x/sys/unix package for any real-world
programs to function.
The values in goarch.sh are taken from the recommendations in this
linux-parisc thread:
https://lore.kernel.org/linux-parisc/7013a3e7d6c9c77c5010bc1c72971758@matoro.tk/t/#u
Additionally it's suggested that the GC issues may be related to the
stack implementation in libgo/runtime/stack.c, because the stack grows
upwards on hppa.
ChangeLog:
* libgo/configure: Regenerate.
* libgo/configure.ac: Add hppa.
* libgo/go/cmd/cgo/main.go: Likewise.
* libgo/go/go/build/syslist.go: Likewise.
* libgo/go/runtime/hash32.go: Build for hppa.
* libgo/go/runtime/lfstack_32bit.go: Likewise.
* libgo/go/runtime/mpagealloc_32bit.go: Likewise.
* libgo/go/runtime/panic32.go: Likewise.
* libgo/go/syscall/endian_big.go: Likewise.
* libgo/goarch.sh: Provide definitions for hppa.
* libgo/match.sh: Add hppa.
* libgo/testsuite/gotest: Likewise.
* libgo/go/internal/syscall/unix/sysnum_linux_hppa.go: New file.
gcc/testsuite/ChangeLog:
* go.test/go-test.exp: Add hppa.
---
gcc/testsuite/go.test/go-test.exp | 3 +++
libgo/configure | 7 +++++--
libgo/configure.ac | 7 +++++--
libgo/go/cmd/cgo/main.go | 2 ++
libgo/go/go/build/syslist.go | 2 +-
libgo/go/internal/syscall/unix/sysnum_linux_hppa.go | 10 ++++++++++
libgo/go/runtime/hash32.go | 2 +-
libgo/go/runtime/lfstack_32bit.go | 4 ++--
libgo/go/runtime/mpagealloc_32bit.go | 2 +-
libgo/go/runtime/panic32.go | 2 +-
libgo/go/syscall/endian_big.go | 2 +-
libgo/goarch.sh | 10 ++++++++++
libgo/match.sh | 4 ++--
libgo/testsuite/gotest | 4 ++--
14 files changed, 46 insertions(+), 15 deletions(-)
create mode 100644 libgo/go/internal/syscall/unix/sysnum_linux_hppa.go
s390x | sh | shbe | sparc | sparc64 | wasm)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha |
hppa | ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 |
mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 |
s390x | sh | shbe | sparc | sparc64 | wasm)
tag1=nonmatchingtag
;;
*)
@@ -341,7 +341,7 @@ x)
aix | android | darwin | dragonfly | freebsd | hurd | ios |
illumos | js | linux | nacl | netbsd | openbsd | plan9 | solaris |
windows | zos)
tag2=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha |
ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 |
mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 |
s390x | sh | shbe | sparc | sparc64 | wasm)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha |
hppa | ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 |
mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 |
s390x | sh | shbe | sparc | sparc64 | wasm)
tag2=nonmatchingtag
;;
esac
b/gcc/testsuite/go.test/go-test.exp
@@ -180,6 +180,9 @@ proc go-set-goarch { } {
"xscale-*-*" {
set goarch "arm"
}
+ "hppa*-*-*" {
+ set goarch "hppa"
+ }
"i?86-*-*" -
"x86_64-*-*" {
if [check_effective_target_ia32] {
@@ -14124,10 +14124,10 @@ esac
# - 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 nios2 ppc ppc64
ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 wasm"
+ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be hppa ia64
m68k mips mipsle mips64 mips64le mips64p32 mips64p32le nios2 ppc ppc64
ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 wasm"
# All known GOARCH family values.
-ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 NIOS2
PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 WASM"
+ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 HPPA IA64 M68K MIPS MIPS64
NIOS2 PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 WASM"
GOARCH=unknown
case ${host} in
@@ -14148,6 +14148,9 @@ case ${host} in
;;
esac
;;
+ hppa*-*-*)
+ GOARCH=hppa
+ ;;
i[34567]86-*-* | x86_64-*-*)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -239,10 +239,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 nios2 ppc ppc64
ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 wasm"
+ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be hppa ia64
m68k mips mipsle mips64 mips64le mips64p32 mips64p32le nios2 ppc ppc64
ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 wasm"
# All known GOARCH family values.
-ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 NIOS2
PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 WASM"
+ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 HPPA IA64 M68K MIPS MIPS64
NIOS2 PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 WASM"
GOARCH=unknown
case ${host} in
@@ -263,6 +263,9 @@ case ${host} in
;;
esac
;;
+ hppa*-*-*)
+ GOARCH=hppa
+ ;;
changequote(,)dnl
i[34567]86-*-* | x86_64-*-*)
changequote([,])dnl
@@ -174,6 +174,7 @@ var ptrSizeMap = map[string]int64{
"amd64": 8,
"arm": 4,
"arm64": 8,
+ "hppa": 4,
"m68k": 4,
"mips": 4,
"mipsle": 4,
@@ -201,6 +202,7 @@ var intSizeMap = map[string]int64{
"amd64": 8,
"arm": 4,
"arm64": 8,
+ "hppa": 4,
"m68k": 4,
"mips": 4,
"mipsle": 4,
@@ -8,4 +8,4 @@ package build
// Do not remove from this list, as these are used for go/build
filename matching.
const goosList = "aix android darwin dragonfly freebsd hurd illumos ios
js linux nacl netbsd openbsd plan9 solaris windows zos "
-const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be loong64
mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv riscv64 s390 s390x
sparc sparc64 wasm alpha m68k nios2 sh shbe "
+const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be loong64
mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv riscv64 s390 s390x
sparc sparc64 wasm alpha hppa m68k nios2 sh shbe "
b/libgo/go/internal/syscall/unix/sysnum_linux_hppa.go
new file mode 100644
@@ -0,0 +1,10 @@
+// Copyright 2022 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.
+
+package unix
+
+const (
+ getrandomTrap uintptr = 339
+ copyFileRangeTrap uintptr = 346
+)
@@ -5,7 +5,7 @@
// Hashing algorithm inspired by
// wyhash:
https://github.com/wangyi-fudan/wyhash/blob/ceb019b530e2c1c14d70b79bfa2bc49de7d95bc1/Modern%20Non-Cryptographic%20Hash%20Function%20and%20Pseudorandom%20Number%20Generator.pdf
-//go:build 386 || arm || mips || mipsle || amd64p32 || armbe || m68k ||
mips64p32 || mips64p32le || nios2 || ppc || riscv || s390 || sh || shbe
|| sparc
+//go:build 386 || arm || mips || mipsle || amd64p32 || armbe || hppa ||
m68k || mips64p32 || mips64p32le || nios2 || ppc || riscv || s390 || sh
|| shbe || sparc
package runtime
b/libgo/go/runtime/lfstack_32bit.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build 386 || arm || mips || mipsle || amd64p32 || armbe || m68k ||
mips64p32 || mips64p32le || nios2 || ppc || riscv || s390 || sh || shbe
|| sparc
-// +build 386 arm mips mipsle amd64p32 armbe m68k mips64p32 mips64p32le
nios2 ppc riscv s390 sh shbe sparc
+//go:build 386 || arm || mips || mipsle || amd64p32 || armbe || hppa ||
m68k || mips64p32 || mips64p32le || nios2 || ppc || riscv || s390 || sh
|| shbe || sparc
+// +build 386 arm mips mipsle amd64p32 armbe hppa m68k mips64p32
mips64p32le nios2 ppc riscv s390 sh shbe sparc
package runtime
b/libgo/go/runtime/mpagealloc_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.
-//go:build 386 || arm || mips || mipsle || wasm || (ios && arm64) ||
amd64p32 || armbe || m68k || mips64p32 || mips64p32le || nios2 || ppc ||
riscv || s390 || sh || shbe || sparc
+//go:build 386 || arm || mips || mipsle || wasm || (ios && arm64) ||
amd64p32 || armbe || hppa || m68k || mips64p32 || mips64p32le || nios2
|| ppc || riscv || s390 || sh || shbe || sparc
// wasm is a treated as a 32-bit architecture for the purposes of the
page
// allocator, even though it has 64-bit pointers. This is because any
wasm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build 386 || amd64p32 || arm || mips || mipsle || armbe || m68k ||
nios2 || ppc || riscv || s390 || sh || shbe || sparc
+//go:build 386 || amd64p32 || arm || mips || mipsle || armbe || hppa ||
m68k || nios2 || ppc || riscv || s390 || sh || shbe || sparc
package runtime
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.
-//go:build ppc64 || s390x || mips || mips64 || armbe || arm64be || m68k
|| ppc || mips64p32 || s390 || shbe || sparc || sparc64
+//go:build ppc64 || s390x || mips || mips64 || armbe || arm64be || hppa
|| m68k || ppc || mips64p32 || s390 || shbe || sparc || sparc64
package syscall
@@ -88,6 +88,16 @@ case $goarch in
;;
esac
;;
+ hppa)
+ bigendian=true
+ defaultphyspagesize=4096
+ family=HPPA
+ int64align=8
+ minframesize=64
+ pcquantum=4
+ ptrsize=4
+ stackalign=64
+ ;;
ia64)
family=IA64
cachelinesize=128
@@ -132,7 +132,7 @@ for f in $gofiles; do
aix | android | darwin | dragonfly | freebsd | illumos | hurd | ios |
js | linux | nacl | netbsd | openbsd | plan9 | solaris | windows | zos)
tag1=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64
| m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le |
nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 | s390x | sh |
shbe | sparc | sparc64 | wasm)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | hppa
| ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 |
mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 |
s390x | sh | shbe | sparc | sparc64 | wasm)
tag1=nonmatchingtag
;;
*)
@@ -149,7 +149,7 @@ for f in $gofiles; do
aix | android | darwin | dragonfly | freebsd | hurd | ios | illumos |
js | linux | nacl | netbsd | openbsd | plan9 | solaris | windows | zos)
tag2=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64
| m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le |
nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 | s390x | sh |
shbe | sparc | sparc64 | wasm)
+ 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | hppa
| ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 |
mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 |
s390x | sh | shbe | sparc | sparc64 | wasm)
tag2=nonmatchingtag
;;
esac
@@ -324,7 +324,7 @@ x)
aix | android | darwin | dragonfly | freebsd | hurd | ios |
illumos | js | linux | nacl | netbsd | openbsd | plan9 | solaris |
windows | zos)
tag1=nonmatchingtag
;;
- 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha |
ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 |
mips64p32le | nios2 | ppc | ppc64 | ppc64le | riscv | riscv64 | s390 |