Port-alpha archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: static link csh/tcsh dumps core



On Mon, Feb 11, 2013 at 04:21:15AM +0000, Christos Zoulas wrote:
> It depends what the ABI requires. I would think that it would be best to
> do 1, then the compiler could reload or not reload and it will still work...

Yes, and attached patch does that (and seems to fix the problem for me).
However, I'd like to get comments from someone who actually knows the ABI
(or have a look at the ABI, anoyne got a pointer?) before commiting this.

The patch includes an unrelated change: memset the whole context to zero,
since we do not fully initialize it. Sounds saner to me and should be of
negligable cost, since we do a syscall later.

Martin
Index: __longjmp14.c
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/alpha/gen/__longjmp14.c,v
retrieving revision 1.5
diff -c -u -p -r1.5 __longjmp14.c
--- __longjmp14.c       28 Apr 2008 20:22:55 -0000      1.5
+++ __longjmp14.c       11 Feb 2013 10:14:14 -0000
@@ -56,6 +56,8 @@ __longjmp14(jmp_buf env, int val)
        if (val == 0)
                val = -1;
 
+       memset(&uc, 0, sizeof uc);
+
        /* Set _UC_SIGMASK and _UC_CPU */
        uc.uc_flags = _UC_SIGMASK | _UC_CPU;
 
@@ -74,6 +76,7 @@ __longjmp14(jmp_buf env, int val)
        uc.uc_mcontext.__gregs[_REG_S5] = sc->sc_regs[R_S5];
        uc.uc_mcontext.__gregs[_REG_S6] = sc->sc_regs[R_S6];
        uc.uc_mcontext.__gregs[_REG_RA] = sc->sc_regs[R_RA];
+       uc.uc_mcontext.__gregs[_REG_GP] = sc->sc_regs[R_GP];
        uc.uc_mcontext.__gregs[_REG_SP] = sc->sc_sp;
        uc.uc_mcontext.__gregs[_REG_PC] = sc->sc_pc;
        uc.uc_mcontext.__gregs[_REG_PS] =
Index: __setjmp14.S
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/alpha/gen/__setjmp14.S,v
retrieving revision 1.5
diff -c -u -p -r1.5 __setjmp14.S
--- __setjmp14.S        12 Jun 2011 05:44:36 -0000      1.5
+++ __setjmp14.S        11 Feb 2013 10:14:14 -0000
@@ -55,6 +55,7 @@ LEAF(__setjmp14, 1)
        stq     s6, (SC_REGS+_REG_S6)(a0)
        stq     ra, (SC_REGS+_REG_RA)(a0)
        stq     sp, (SC_REGS+_REG_SP)(a0)
+       stq     gp, (SC_REGS+_REG_GP)(a0)
 
        /*
         * get signal information


Home | Main Index | Thread Index | Old Index