This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: Assembler question


On Sat, Jun 07, 2003 at 10:47:19PM +0000, Sumesh UdayaKumaran wrote:
> 
> Hi
> Iam using the gnu assembler infrastructure for my research. I had the 
> following question.
>        My question is for a statement like "lrw r15,A"
> where in the code is the variable A resolved. In other words where is it
> assigned some address.
> 
> 
> I would appeciate any help you can give

If A is known to be a constant in the assembly module that is produced by the
compiler, it will be assigned by the assembler.

For most targets, if 'lrw r15,A' involves pc-relative access (for most machines
this isn't true for loads, but there have been machines like the ns32k that did
have pc-relative load instructions), and A is a label in the same section as
the instruction, the assembler will fill it in as a constant.  There are some
targets, that the assembler just generates a relocation record.

Otherwise, the assembler generates a relocation record.  The linker will
generally fix up the reference so it points to A.  Sometimes however, the
linker will defer to the dynamic linker, if shared libraries are used, and A is
defined in a shared library.

-- 
Michael Meissner
email: gnu@the-meissners.org
http://www.the-meissners.org


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