public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, go]: S/390: Fix generation of PtraceRegs
@ 2017-06-27  7:52 Andreas Krebbel
  2017-06-27 21:51 ` [gofrontend-dev] " Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Krebbel @ 2017-06-27  7:52 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

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.


[-- Attachment #2: gcc-gofix --]
[-- Type: text/plain, Size: 2405 bytes --]

commit e2903db6cca0a97c3320ce58ec1405cc3bedb5c2
Author: Andreas Krebbel <krebbel@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//'`

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gofrontend-dev] [PATCH, go]: S/390: Fix generation of PtraceRegs
  2017-06-27  7:52 [PATCH, go]: S/390: Fix generation of PtraceRegs Andreas Krebbel
@ 2017-06-27 21:51 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2017-06-27 21:51 UTC (permalink / raw)
  To: Andreas Krebbel; +Cc: gcc-patches, gofrontend-dev

On Tue, Jun 27, 2017 at 12:52 AM, Andreas Krebbel
<krebbel@linux.vnet.ibm.com> wrote:
>
> 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.

Thanks for sending this.

Committed to mainline.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-27 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27  7:52 [PATCH, go]: S/390: Fix generation of PtraceRegs Andreas Krebbel
2017-06-27 21:51 ` [gofrontend-dev] " Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).