linux-mips
[Top] [All Lists]

understanding elf_machine_load_address

To: linux-mips@oss.sgi.com
Subject: understanding elf_machine_load_address
From: Guido Guenther <guido.guenther@gmx.net>
Date: Sat, 8 Dec 2001 15:11:42 +0100
Mail-followup-to: linux-mips@oss.sgi.com
Sender: owner-linux-mips@oss.sgi.com
User-agent: Mutt/1.3.24i
Hi,
I'm trying to understand to following snippet from glibc's
sysdeps/mips/dl-machine.h:

elf_machine_load_address (void)
{
  ElfW(Addr) addr;
  asm ("        .set noreorder\n"
       "        la %0, here\n"
       "        bltzal $0, here\n"
       "        nop\n"
       "here:   subu %0, $31, %0\n"
       "        .set reorder\n"
       :        "=r" (addr)
       :        /* No inputs */
       :        "$31");
  return addr;
}

As of my understanding addr is zero since $31-%0 is always
zero(%0 stored (before the subu) the address of 'here', as does $31
after the bltzal). Please beat me with a cluebat.
 -- Guido

<Prev in Thread] Current Thread [Next in Thread>