stg_ap_v_ret porting crash: solved?

Ian Lynagh igloo at earth.li
Fri Sep 12 03:54:15 EDT 2003


On Thu, Sep 11, 2003 at 07:53:02PM +1000, Donald Bruce Stewart wrote:
> simonmar:
> >  
> > > Things aren't so easy with alpha as gcc rejects the -mieee 
> > > flag when GHC
> > > calls gcc for -cpp'ing. I fear a nasty hacky wrapper may be in order.
> > 
> > Is this when running gcc on the Alpha, or on the bootstrapping host?
> 
> alpha-dec-osf3 bootstrapped quite cleanly today. Using the right
> config.h makes a big difference ;) It isn't working yet though.
> 
> I had to comment out/hack various decls in the rts on the alpha,
> which let the compile go through. The GHC that got built seems to
> loop when invoked. Probably an MBlock thing, I haven't looked
> into it yet.

With the wrapper everything was fine here on the host side.

I then had to do the I_ -> int stg_exit thing as committed to CVS for
IA64, and also change machine/{pal,fpu}.h to asm/{pal,fpu}.h in
ghc/rts/Adjuster.c and ghc/rts/Signals.c. (I'd already applied the
MBLOCK hack from x86-64). The compile then failed with

gcc -O -Wall -DCOMPILING_STDLIB  -I../../../ghc/includes -I../../../ghc/rts -I../include    -c writeError.c -o writeError.o
In file included from ../../../ghc/includes/Stg.h:189,
                 from ../../../ghc/includes/Rts.h:20,
                 from writeError.c:19:
../../../ghc/includes/TailCalls.h:86: warning: call-clobbered register used for global register variable
writeError.c: In function `writeErrString__':
writeError.c:47: error: unable to find a register to spill in class `R27_REG'
writeError.c:47: error: this is the insn:
(call_insn 31 30 34 1 0x2000079b970 (parallel [
            (call (mem:DI (reg/v/f:DI 9 $9 [69]) [0 S8 A64])
                (const_int 0 [0x0]))
            (use (reg:DI 29 $29))
            (clobber (reg:DI 26 $26))
        ]) 197 {*call_osf_1_er} (insn_list 30 (nil))
    (expr_list:REG_DEAD (reg:DI 27 $27)
        (expr_list:REG_DEAD (reg:DI 16 $16)
            (expr_list:REG_DEAD (reg/v/f:DI 9 $9 [69])
                (expr_list:REG_UNUSED (reg:DI 26 $26)
                    (nil)))))
    (expr_list (use (reg:DI 16 $16))
        (nil)))
writeError.c:47: confused by earlier errors, bailing out
make[2]: *** [writeError.o] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1
make: Leaving directory `/home/igloo/ghc6-doc/ghc-6.0.1/libraries'

(gcc is 3.3). Same thing with different optimisation levels but 2.95
compiled it fine. Is this the same as the problem you had on sparc,
Simon?

I gcc -E'd and then removed unused stuff to try to get something to send
off as a bug report, but then found the result compiled under 3.3 so
kept going.

This resulted in a working compiler, so I tried to build ghc using it
with gcc-2.95. I had to move the #include "TailCalls.h" up in
ghc/includes/Stg.h to get the

register void *_procedure __asm__("$27");

above all the function definitions.

Now I have

../../ghc/compiler/ghc-inplace -H16m -O -O2 -static    -c Apply.hc -o Apply.o
ghc-asm: unknown prologue mangling? alpha-unknown-linux
Prologue junk?:         .globl stg_ap_0_ret
        .ent stg_ap_0_ret
stg_ap_0_ret:
        .eflag 48
        .frame $30,16,$26,0
        .mask 0x4000000,-16
        ldgp $29,0($27)
$stg_ap_0_ret..ng:
        lda $30,-16($30)
        stq $26,0($30)
        .prologue 1

and I'm going to bed.


Ian



More information about the Glasgow-haskell-users mailing list