Hi,

go bootstrap fails on s390x starting with r249472. With including the ptrace 
header the s390 special
code in mksysinfo.sh isn't used anymore:

if test "$regs" = ""; then
  # s390
  regs=`grep '^type __user_regs_struct struct' gen-sysinfo.go || true`
  if test "$regs" != ""; then
    # Substructures of __user_regs_struct on s390
    upcase_fields "__user_psw_struct" "PtracePsw" >> ${OUT} || true
    upcase_fields "__user_fpregs_struct" "PtraceFpregs" >> ${OUT} || true
    upcase_fields "__user_per_struct" "PtracePer" >> ${OUT} || true
  fi
fi

Instead we fall through to the code with the generic handling which appears to 
work fine. The only
difference is that the former code used to uppercase the initial letters of the 
struct member while
the generic handler doesn't. The only user however appear to be 
syscall_linux_s390(x).go.

The attached patch removes the mksysino.sh S/390 specific handling and adjusts 
the
syscall_linux_s390* file accordingly.

This fixes the bootstrap on s390x.

commit e2903db6cca0a97c3320ce58ec1405cc3bedb5c2
Author: Andreas Krebbel <kreb...@linux.vnet.ibm.com>
Date:   Mon Jun 26 16:50:03 2017 +0200

    S/390: Fix go bootstrap

diff --git a/libgo/go/syscall/syscall_linux_s390.go 
b/libgo/go/syscall/syscall_linux_s390.go
index a744f6b..d6d3f6a 100644
--- a/libgo/go/syscall/syscall_linux_s390.go
+++ b/libgo/go/syscall/syscall_linux_s390.go
@@ -8,9 +8,9 @@ package syscall
 
 import "unsafe"
 
-func (r *PtraceRegs) PC() uint64 { return uint64(r.Psw.Addr) }
+func (r *PtraceRegs) PC() uint64 { return uint64(r.Psw.addr) }
 
-func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = uint32(pc) }
+func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.addr = uint32(pc) }
 
 func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
        return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
diff --git a/libgo/go/syscall/syscall_linux_s390x.go 
b/libgo/go/syscall/syscall_linux_s390x.go
index 44d5679..f3701dc 100644
--- a/libgo/go/syscall/syscall_linux_s390x.go
+++ b/libgo/go/syscall/syscall_linux_s390x.go
@@ -8,9 +8,9 @@ package syscall
 
 import "unsafe"
 
-func (r *PtraceRegs) PC() uint64 { return r.Psw.Addr }
+func (r *PtraceRegs) PC() uint64 { return r.Psw.addr }
 
-func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = pc }
+func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.addr = pc }
 
 func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
        return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 8fd8ead..fe0bb54 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -310,17 +310,8 @@ upcase_fields () {
 # _user_regs_struct.
 regs=`grep '^type _user_regs_struct struct' gen-sysinfo.go || true`
 if test "$regs" = ""; then
-  # s390
-  regs=`grep '^type __user_regs_struct struct' gen-sysinfo.go || true`
-  if test "$regs" != ""; then
-    # Substructures of __user_regs_struct on s390
-    upcase_fields "__user_psw_struct" "PtracePsw" >> ${OUT} || true
-    upcase_fields "__user_fpregs_struct" "PtraceFpregs" >> ${OUT} || true
-    upcase_fields "__user_per_struct" "PtracePer" >> ${OUT} || true
-  else
-    # mips*
-    regs=`grep '^type _pt_regs struct' gen-sysinfo.go || true`
-  fi
+  # mips*
+  regs=`grep '^type _pt_regs struct' gen-sysinfo.go || true`
 fi
 if test "$regs" != ""; then
   regs=`echo $regs | sed -e 's/type _pt_regs struct//'`

Reply via email to