On Fri, Nov 11, 2016 at 6:02 AM, Rainer Orth
<r...@cebitec.uni-bielefeld.de> wrote:
>
>> This patch to the Go frontend and libgo copies the signal code from
>> the Go 1.7 runtime.
>>
>> This adds a little shell script to auto-generate runtime.sigtable from
>> the known signal names.
>>
>> This forces the main package to always import the runtime package.
>> Otherwise some runtime package global variables may never be
>> initialized.
>>
>> This sets the syscallsp and syscallpc fields of g when entering a
>> syscall, so that the runtime package knows when a g is executing a
>> syscall.
>>
>> This fixes runtime.funcPC to avoid dead store elimination of the
>> interface value when the function is inlined.
>>
>> The signal code in C now has some target-specific code to return the
>> PC where the signal occurred and to dump the registers on a hard
>> crash.  This is what the gc toolchain does as well.  I wrote versions
>> of that code for x86 GNU/Linux.  Other targets will fall back
>> reasonably and display less information.
>>
>> Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.
>> Bootstrapped and ran relevant tests on sparc-sun-solaris.  Committed
>> to mainline.
>
> this has caused a number of testsuite failures on Solaris 10/x86 only:
> Solaris 11 and 12/x86 are fine, still waiting for Solaris 10/SPARC
> results:

...

>   info is NULL here!

Yes, I see it too.  Fixed by this patch.  Bootstrapped on
x86_64-pc-linux-gnu and i386-sun-solaris10.  Ran Go testsuite on
GNU/Linux, and ran some relevant tests on Solaris.  Committed to
mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 242072)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-3c8d91cff0ad3d233ebd268f88a3749d38a0aac1
+eb716b515356166d3177e6244619be5901f31162
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/runtime/signal_gccgo.go
===================================================================
--- libgo/go/runtime/signal_gccgo.go    (revision 242060)
+++ libgo/go/runtime/signal_gccgo.go    (working copy)
@@ -47,7 +47,14 @@ type sigctxt struct {
        ctxt unsafe.Pointer
 }
 
-func (c *sigctxt) sigcode() uint64 { return uint64(c.info.si_code) }
+func (c *sigctxt) sigcode() uint64 {
+       if c.info == nil {
+               // This can happen on Solaris 10.  We don't know the
+               // code, just avoid a misleading value.
+               return _SI_USER + 1
+       }
+       return uint64(c.info.si_code)
+}
 
 //go:nosplit
 func sigblock() {
Index: libgo/go/runtime/signal_sigtramp.go
===================================================================
--- libgo/go/runtime/signal_sigtramp.go (revision 242060)
+++ libgo/go/runtime/signal_sigtramp.go (working copy)
@@ -29,7 +29,8 @@ func sigtrampgo(sig uint32, info *_sigin
                        // get here anyhow.
                        return
                }
-               badsignal(uintptr(sig), &sigctxt{info, ctx})
+               c := sigctxt{info, ctx}
+               badsignal(uintptr(sig), &c)
                return
        }
 
Index: libgo/runtime/go-signal.c
===================================================================
--- libgo/runtime/go-signal.c   (revision 242060)
+++ libgo/runtime/go-signal.c   (working copy)
@@ -187,7 +187,11 @@ getSiginfo(siginfo_t *info, void *contex
        Location loc[1];
        int32 n;
 
-       ret.sigaddr = (uintptr)(info->si_addr);
+       if (info == nil) {
+               ret.sigaddr = 0;
+       } else {
+               ret.sigaddr = (uintptr)(info->si_addr);
+       }
        ret.sigpc = 0;
 
        // There doesn't seem to be a portable way to get the PC.

Reply via email to