Setting up alpha stack frames

tim.jones@mail.com (Timothy Jones)
6 May 2003 19:18:05 -0400

          From comp.compilers

Related articles
Setting up alpha stack frames tim.jones@mail.com (2003-05-06)
Re: Setting up alpha stack frames Len.Lattanzi@Migration.com (2003-05-14)
Re: Setting up alpha stack frames firefly@diku.dk (Peter \Firefly\Lund) (2003-05-14)
Re: Setting up alpha stack frames anton@mips.complang.tuwien.ac.at (2003-05-14)
| List of all articles for this month |
From: tim.jones@mail.com (Timothy Jones)
Newsgroups: comp.compilers,comp.arch
Date: 6 May 2003 19:18:05 -0400
Organization: http://groups.google.com/
Keywords: architecture, question
Posted-Date: 06 May 2003 19:18:05 EDT

Hi all,


I'm having some trouble adding an instruction (even if it's a nop) to
the start of a procedure before the stack frame is initialised. I want
to put it here because I want it to go before any other instruction is
executed in each basic block.


The first problem I had was with alignment. I started with the
following code, where hello is the name of a simple procedure which
prints "Hello World!". I added the nop at the start and get this
error:


hello:
                nop
ldgp $gp,0($27)
lda $sp,-32($sp)
stq $26,0($sp)
.mask 0x04000000, -32
.frame $sp, 32, $26, 16
.prologue 1,
stq $gp,24($sp)
.loc 2 5
lda $16,__tmp_string_0
lda $27,printf
jsr $26,($27)
ldq $gp,24($sp)
.loc 2 6
ldq $26,0($sp)
lda $sp,32($sp)
ret ($26),1
.end hello


romeu:~> cc -o main.before main.s
romeu:~> ./main.before
Unaligned access pid=21607 <main.before> va=0x14000014c pc=0x1200011a8
ra=0x1200011ec inst=0xa77d80d0
zsh: segmentation fault (core dumped) ./main.before




So I add alignment like this:


hello:
                .align 0
nop
                .align 4
ldgp $gp,0($27)




romeu:~> cc -o main.align main.s
romeu:~> ./main.align
zsh: segmentation fault (core dumped) ./main.align




I don't know what the problem is at all. I can't see a reason this
alters anything in the program itself and all symbols are labels at
the point I add the instruction so they shouldn't be affected. Can
anybody help or point me in another direction at all?


Thanks
Tim


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.