Surprisingly yes, a trivial program does work. Seems the problems only
arise on anything more than that.
$ go version
go version go1.18 gccgo (Gentoo 12.2.1_p20221008 p1) 12.2.1 20221008
linux/hppa
$ cat test.go
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
$ go build test.go
$ ./test
Hello World!
Main issue is that the exact stacktrace is different in between runs. I
tried setting GOMAXPROCS=1 in order to make it reproducible but that
completely changed the error.
$ GOMAXPROCS=1 go install github.com/gokcehan/lf@latest
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x0]
goroutine 15 [running]:
memchr
:0
created by net_1http.Transport.queueForDial
/var/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-12-20221008/libgo/go/net/http/transport.go:1418
+0x37b
Here is as much info as I am able to get out of gdb:
$ GOMAXPROCS=1 gdb --quiet --args /usr/local/bin/go install
github.com/gokcehan/lf@latest
Reading symbols from /usr/local/bin/go...
Reading symbols from
/usr/lib/debug//usr/hppa2.0-unknown-linux-gnu/gcc-bin/12/go-12.debug...
(gdb) r
Starting program: /usr/local/bin/go install
github.com/gokcehan/lf@latest
warning: Unable to find libthread_db matching inferior's thread library,
thread debugging will not be available.
[New LWP 7838]
[New LWP 7839]
Thread 3 "go" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 7839]
0xf7556aa8 in memcmp () from /lib/libc.so.6
(gdb) bt full
#0 0xf7556aa8 in memcmp () from /lib/libc.so.6
No symbol table info available.
#1 0xf8d41134 in net_1http.Transport.dialConn (t=0x41a90340,
t@entry=0x41acc370, ctx=..., param=...)
at
/var/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-12-20221008/libgo/go/net/http/transport.go:1645
trace = 0x0
wrapErr = 0x433107ec
cm = 0x4180b950
pconn = 0x41acc370
err = {__methods = 0x0, __object = 0x0}
#2 0xf8d42b7c in net_1http.Transport.dialConnFor (t=0x41acc370,
w=0x4180b950)
at
/var/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-12-20221008/libgo/go/net/http/transport.go:1449
pc = <optimized out>
err = <optimized out>
delivered = <optimized out>
#3 0xf8d42eb4 in net/http.go..thunk166 (__go_thunk_parameter=<optimized
out>)
at
/var/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-12-20221008/libgo/go/net/http/transport.go:1418
No locals.
#4 0xf8ea2264 in runtime.kickoff ()
at
/var/tmp/portage/sys-devel/gcc-12.2.1_p20221008/work/gcc-12-20221008/libgo/go/runtime/proc.go:1316
gp = 0x4180b950
fv = 0x4180e5b8
param = 0x41acc370
#5 0xf74f4284 in setcontext () from /lib/libc.so.6
No symbol table info available.
#6 0x00000000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt
stack?)
This seems to have something at least, is it useful?
-------- Original Message --------
Subject: Re: Correct goarch.sh settings for gccgo on hppa?
Date: 2022-11-26 22:17
From: Ian Lance Taylor <iant@xxxxxxxxxx>
To: matoro <matoro_mailinglist_kernel@xxxxxxxxx>
On Fri, Nov 25, 2022, 9:39 PM matoro
<matoro_mailinglist_kernel@xxxxxxxxx>
wrote:
Oh sorry, should have clarified. I did all those parts already, just
didn't include them because I assumed the at-fault piece would be in
goarch.sh. This is for Linux only.
All I did for the conditional stuff was add HPPA to all the 32-bit
files, and add the two unique syscall numbers. This was based on the
instructions in configure.ac. Here is the complete patch:
https://dpaste.com/HVHNU9BKF.txt
Is there something I might be missing?
Good to hear you have updated the build tags. I don't know what is
wrong,
tough. Can you run the failing program under the debugger and find out
where that address is coming from?
But first: does a trivial hello world program work?
Ian
-------- Original Message --------
Subject: Re: Correct goarch.sh settings for gccgo on hppa?
Date: 2022-11-26 00:25
From: Ian Lance Taylor <iant@xxxxxxxxxx>
To: matoro <matoro_mailinglist_kernel@xxxxxxxxx>
On Fri, Nov 25, 2022 at 8:31 PM matoro
<matoro_mailinglist_kernel@xxxxxxxxx> wrote:
>
> Thank you both for the suggestions. I tried the following values:
>
> 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
>
> But unfortunately got the same result. I wonder if there is something
> else missing?
>
> Ian, if you have the time, I have a machine you can use to look at
> this.
As far as I know gccgo has never been ported to parisc. This requires
a fair bit more than just fixing up goarch.sh. There are a bunch of
files in libgo that are conditionally compiled based on the GOARCH
(processor) and GOOS (operating system) values. These are marked in
the files by comments that start with "+build" or "go:build". Many of
those comments will need to be adjusted to recognize parisc and
whatever operating system you are using. If this is for HP/UX, there
is also operating specific code required in various places.
I'm happy to answer questions about doing the port, but it's not a
trivial task.
Ian