From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from matoro.tk (unknown [IPv6:2600:1700:4b10:9d80::2]) by sourceware.org (Postfix) with ESMTPS id 39932384C933 for ; Wed, 14 Dec 2022 01:04:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39932384C933 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=matoro.tk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=matoro.tk DKIM-Signature: a=rsa-sha256; bh=JtCuS9jLs+fTju8SWSuDIRb81teKNsOiJqdPEp4b/Cg=; c=relaxed/relaxed; d=matoro.tk; h=Subject:Subject:Sender:To:To:Cc:From:From:Date:Date:MIME-Version:MIME-Version:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Reply-To:In-Reply-To:Message-Id:Message-Id:References:Autocrypt:Openpgp; i=@matoro.tk; s=20221003; t=1670979849; v=1; x=1671411849; b=TJhbKQBV3N7oWRoNSD7WAnUm87dTPg0+BM90MCnKuZT44YCp2rPSIDiswfs51+EiGbkz9mHI NOYRG4A693l3PTX43WyEDw1AsDgyMhKIIxCzX2cTpnv3UesQInXWBGaeN4PD6AcPNH+nyPv17iE SwO8fYKpKBteQWefkwFbKEFUM9W4e0R4lESEdmAHatTaKcXKX73ILA+3H4JTsIUJ1oq+9I3CxXp MmVersfk09+em1g40S5YQajXxAle3VmEzMBNDztjM1iRzEIcZjNnD7VsCHjWarDajs8bEXjXuoT rLfHIzM43hy9d6bG0SpglZYH0YCteSJtwfbW1yEQLSWHXiUob+TYb7Vn8oUZM18+pOXIZ+doRPc 9n4SMxrXK9agVNlhPHSzSHMg+yRnd34nQd2Ey5oNmbqJ17XzJ4BJCmr2T6Ar7miEIkuopw9ehTc CPdFMavkrGhjf082mUmzH3wilaB/XpD7RqM7bPVCubsXE7jKEapMhZ1imaBBgJhVqdZ3eMekUEB nadZVNVNp1ygQkR8rjXN7h83wQx6JOA8zT7qRdougsPTy3/eYrsXzK3DLADhUjL5m/YbZTMs1gW qiAhDHWfSrEhFXYMoeJNHzEll1P3AO8THGf1RvglxnJS2M9Ti0o+J7nHWFocrSBa9QZesFsPPdO R0igj78yCn0= Received: by matoro.tk (envelope-sender ) with ESMTPS id 9e341916; Tue, 13 Dec 2022 20:04:09 -0500 MIME-Version: 1.0 Date: Tue, 13 Dec 2022 20:04:09 -0500 From: matoro To: gcc-patches@gcc.gnu.org Subject: [PATCH] libgo: add hppa as known target Message-ID: X-Sender: matoro_mailinglist_gcc-patches@matoro.tk Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 diff --git a/gcc/testsuite/go.test/go-test.exp b/gcc/testsuite/go.test/go-test.exp index 11c178ad7..fb28b785b 100644 --- a/gcc/testsuite/go.test/go-test.exp +++ 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] { diff --git a/libgo/configure b/libgo/configure index 460fdad70..9bffd2a32 100755 --- a/libgo/configure +++ b/libgo/configure @@ -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. */ diff --git a/libgo/configure.ac b/libgo/configure.ac index 09554a37a..97e26d216 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -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 diff --git a/libgo/go/cmd/cgo/main.go b/libgo/go/cmd/cgo/main.go index 186aef06c..269ac3d12 100644 --- a/libgo/go/cmd/cgo/main.go +++ b/libgo/go/cmd/cgo/main.go @@ -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, diff --git a/libgo/go/go/build/syslist.go b/libgo/go/go/build/syslist.go index 1b11365f5..31f31b5fe 100644 --- a/libgo/go/go/build/syslist.go +++ b/libgo/go/go/build/syslist.go @@ -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 " diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_hppa.go b/libgo/go/internal/syscall/unix/sysnum_linux_hppa.go new file mode 100644 index 000000000..2b6b2b30c --- /dev/null +++ b/libgo/go/internal/syscall/unix/sysnum_linux_hppa.go @@ -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 +) diff --git a/libgo/go/runtime/hash32.go b/libgo/go/runtime/hash32.go index 52977ee3c..cb4180c92 100644 --- a/libgo/go/runtime/hash32.go +++ b/libgo/go/runtime/hash32.go @@ -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 diff --git a/libgo/go/runtime/lfstack_32bit.go b/libgo/go/runtime/lfstack_32bit.go index c0eb665dd..89e559404 100644 --- a/libgo/go/runtime/lfstack_32bit.go +++ 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 diff --git a/libgo/go/runtime/mpagealloc_32bit.go b/libgo/go/runtime/mpagealloc_32bit.go index 0979e0024..ae8df34e7 100644 --- a/libgo/go/runtime/mpagealloc_32bit.go +++ 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 diff --git a/libgo/go/runtime/panic32.go b/libgo/go/runtime/panic32.go index df4afae4b..4127f8360 100644 --- a/libgo/go/runtime/panic32.go +++ b/libgo/go/runtime/panic32.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 || 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 diff --git a/libgo/go/syscall/endian_big.go b/libgo/go/syscall/endian_big.go index e6b1163ba..50aef3dd9 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. -//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 diff --git a/libgo/goarch.sh b/libgo/goarch.sh index 977f318b3..e0d6a3ad8 100755 --- a/libgo/goarch.sh +++ b/libgo/goarch.sh @@ -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 diff --git a/libgo/match.sh b/libgo/match.sh index e5ed98de4..153ed9da7 100755 --- a/libgo/match.sh +++ b/libgo/match.sh @@ -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 diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest index 0a0a7e14d..cd62a77cd 100755 --- a/libgo/testsuite/gotest +++ b/libgo/testsuite/gotest @@ -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 | 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 -- 2.38.2