linux-mips
[Top] [All Lists]

Re: Setting gp on pic code

To: Alex Gonzalez <langabe@gmail.com>
Subject: Re: Setting gp on pic code
From: Brett Foster <fosterb@uoguelph.ca>
Date: Mon, 16 Jan 2006 07:11:53 -0500
Cc: linux-mips <linux-mips@linux-mips.org>
In-reply-to: <c58a7a270601160204h41e5dca7pa9c26578b6b29f6f@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <c58a7a270601160204h41e5dca7pa9c26578b6b29f6f@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)
Alex Gonzalez wrote:

Hi,

I am trying to set the gp register on pic code as follows:

"la gp,_gp"

Disassembling the resulting code,

"lw gp,0(gp)"
Yes, this is normal... Use the following to set up the GP:
       //init GP
       lui     gp,%HI(_gp)
       ori     gp,%LO(_gp)

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