This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIPS question: _gp = (. + 0x8000);


Hi Jonathan,

Thanks a lot for your response. That was very helpful.

I have a small question related to this.

From YAMON's (mips's ROM monitor) linker scrip:

_gp = ABSOLUTE(. + 0x7ff0);




Is there a good reason to pick 0x7ff0 or any other offset instead of 0x8000?

Thanks & Cheers,
-Mike.



From: Jonathan Larmour <jifl@eCosCentric.com>
To: Michael Anburaj <embeddedeng@hotmail.com>
CC: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] MIPS question: _gp = (. + 0x8000);
Date: Thu, 19 Feb 2004 06:19:44 +0000

Michael Anburaj wrote:
Hi,

I have a question regarding the following line found in a lot of MIPS linker scripts:

_gp = (. + 0x8000);

_gp gets loaded into $gp. How does this value ?_gp? relate with access to .sdata & .sbss session using $gp?

Access to stuff in sdata/sbss uses different instructions that are more efficient for small amounts of data. But the tradeoff is having to use a fixed base register for accessing them. That is $gp. GCC/GAS generate relocs relative to the _gp symbol, which the linker munges appropriately so that as long as $gp points to _gp everything works.


Why is 0x8000 added (to the foot of .sdata section)? To Place $gp halfway in the 64KB $gp accessible space??

Correct. The offsets that GCC uses are signed.



_________________________________________________________________
Watch high-quality video with fast playback at MSN Video. Free! http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/



-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]