This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: problem with initializing ppc-eabi r13 (sdata)



"Matthew.R.Wette@jpl.nasa.gov" wrote:

> I am looking for insight/help in working with the GNU loader.  I am trying to
> work with my own versions of startup code, etc to understand how _start,
> _eabi, main, crt0, ... all work together.

>
> Here is the problem.  I want to initialize r13 with the address of the
> start of .sdata segment.  If I look in the map file that is generated
> by the loader, this address, given by _SDA_BASE_, is 0xa5a8.  When I
> copy _SDA_BASE_ to "v1" and print it out from the program I get 0x125a8.

Please feel confident that everything is right here. The PowerPC addressing
range of a "near" (small data) variable is [-0x8000..+7FFF] relative to %r13. So
the linker maps small data from 0xA5A8 (up to 0x1A5A7), and the startup code
sets %r13 to 0x125A8 (=0xA5A8+0x8000), so that the very first small data
variable is addresses as -0x8000(%r13). I learned this using commercial
compilers, but they share the EABI specifications with the gnu tools. Perhaps
the loader map of the gnu tools is a bit misleading in reporting the _SDA_BASE_
value.

Good luck

--

- Thierry Moreau

CONNOTECH Experts-conseils inc.
9130 Place de Montgolfier
Montreal, Qc
H2M 2A1

Tel.: (514)385-5691
Fax:  (514)385-5900

e-mail: thierry.moreau@connotech.com



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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