This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: efficient memory access from assembly
- To: "Jeger, Tobias" <tobias dot jeger at intersil dot com>
- Subject: Re: efficient memory access from assembly
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Tue, 20 Feb 2001 11:19:01 +0000
- cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>, Richard dot Earnshaw at arm dot com
- Organization: ARM Ltd.
- Reply-To: Richard dot Earnshaw at arm dot com
> Hi.
>
> I am currently porting code (both C and assembler) from the ARM toolkit to the
> GNU GCC environment. Reading through the documentstion of GCC, I can't figure
> out how to port register relative memory access instructions without duplicating
> information. So what I have is a (relocatable) area of data storage, where space
> is allocated for a number of variables.
> Having the base-address of this area in a register (say r5), I would like to be
> able to perform accesses of the kind
>
> ldr r1, [r5, #<variablename>]
>
> so <variablename> must be the offset from the base-address. The location of the
> code accessing the variables must be completely independent from the area where
> the variables are stored at assembly-time, and the variables need to be
> accessible to code in different files. Must this be done using {absolute}
> addresses, which overlap at link-time, or does anybody have a better idea?
>
I may have mis-understood what you are asking here, so apologies if I'm
talking baloney.
It looks to me like you are asking if the assembler supports based data
regions. If so, then I think you are asking in the wrong list
(binutils@sources.redhat.com would be a better place to ask). I think you
will find the answer is no, but I could be wrong.
If we really are talking about C, then GCC for the ARM does not support
position-independent data, so about the best I can suggest is to create a
large struct containing all the symbols that you want to access off a
single base. You then might be able to set up the base registers with
gcc-isms, for example an asm statement.
Richard.