advancetoolchain/advance-toolchain

go compiler on AT14.0 on POWER10 is broken

carlelove opened this issue · 4 comments

I am trying to compile a go program from the GDB testsuite and the go compiler segfaults.

Here is how to reproduce the issue.

  1. on ltcden2-lp1 cd to the GDB go tests. In my case they are in carll@ltcden2-lp1:~/GDB/binutils-gdb-current/gdb/testsuite/gdb.go

  2. try to compile the intefers.go file, i.e.

    carll@ltcden2-lp1:~/GDB/binutils-gdb-current/gdb/testsuite/gdb.go$ go integers.go
    Segmentation fault (core dumped)

It looks like there is something wrong with /opt/at14.0/lib64/power10/libgo.so.16:

$ /opt/at14.0/bin/go help
Segmentation fault (core dumped)
$ LD_PRELOAD=/opt/at14.0/lib64/libgo.so.16 /opt/at14.0/bin/go help
Go is a tool for managing Go source code.
...

It's stuck in a function that I can't identify:

=> 0x00007ffff7726f80 <+64>:    ld      r11,0(r3)
   0x00007ffff7726f84 <+68>:    ld      r12,8(r3)
   0x00007ffff7726f88 <+72>:    mr      r0,r3
   0x00007ffff7726f8c <+76>:    cmpdi   r11,0
   0x00007ffff7726f90 <+80>:    add     r3,r12,r13
   0x00007ffff7726f94 <+84>:    beqlr
   0x00007ffff7726f98 <+88>:    mr      r3,r0
   0x00007ffff7726f9c <+92>:    mflr    r11
   0x00007ffff7726fa0 <+96>:    std     r11,8(r1)
   0x00007ffff7726fa4 <+100>:   std     r2,24(r1)
   0x00007ffff7726fa8 <+104>:   ld      r12,4744(r2)
   0x00007ffff7726fac <+108>:   mtctr   r12
   0x00007ffff7726fb0 <+112>:   bctrl
   0x00007ffff7726fb4 <+116>:   ld      r2,24(r1)
   0x00007ffff7726fb8 <+120>:   ld      r11,8(r1)
   0x00007ffff7726fbc <+124>:   mtlr    r11
   0x00007ffff7726fc0 <+128>:   blr

This function received an r3 value that looks broken:

>>> print/x $r3
$1 = 0xf20

Although unrelated to the issue, I also noticed this function is expecting that a TOC is properly set.

I'm testing if this patch fixes the issue.

I also had to apply commit 2dd7b93778d551b6981c8086ecb38e26f677bd2b.

After that, I was able to build and run one of the tests on P10:

$ ~/opt/at14.0/bin/go run hello.go; echo $?
Before assignment
Hello, world!
0

This issue has been fixed and will be available in AT 14.0-4.