|Setting up alpha stack frames firstname.lastname@example.org (2003-05-06)|
|Re: Setting up alpha stack frames Len.Lattanzi@Migration.com (2003-05-14)|
|Re: Setting up alpha stack frames email@example.com (Peter \Firefly\Lund) (2003-05-14)|
|Re: Setting up alpha stack frames firstname.lastname@example.org (2003-05-14)|
|From:||"Peter \"Firefly\" Lund" <email@example.com>|
|Date:||14 May 2003 00:45:10 -0400|
|Organization:||Department of Computer Science, University of Copenhagen|
|Posted-Date:||14 May 2003 00:45:09 EDT|
On Wed, 6 May 2003, Timothy Jones wrote:
> The first problem I had was with alignment. I started with the
Nope. With not knowing the ABI.
> ldgp $gp,0($27)
Read up on the ldgp pseudo-instruction. The expression on the right
is supposed to evaluate at run-time to the address of the instruction
but $27 is the PV register (Procedure Value, I guess... memory is
getting rusty), which is setup to point to the subroutine to jump to
just before the jump is performed (see how printf is called a few
instructions later in the snippet). In other words: 0($27) points to
The consequences are that the program doesn't load the correct address
of the GOT (Global Offset Table) which means that everytime your
program needs an immediate longer than 8 bits, it will fetch an
incorrect value from the GOT. It is probably the lda $16,
__tmp_string_0 pseudo instruction that either segfaults (due to use of
an illegal pointer for the GOT start address) or fetches an illegal
address which is then passed to printf.
Always, Always, Always read the ABI before doing low-level stuff like
compiler writing or direct massaging of machine code.
PS: Mind the ldgp's after function calls, too.
Return to the
Search the comp.compilers archives again.