This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Address of label which is defined within an asm statement?
- From: Ian Lance Taylor <iant at google dot com>
- To: "Ioannis E. Venetis" <venetis at capsl dot udel dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 27 Jun 2006 23:08:23 -0700
- Subject: Re: Address of label which is defined within an asm statement?
- References: <44A17BEF.3080904@capsl.udel.edu>
"Ioannis E. Venetis" <venetis@capsl.udel.edu> writes:
> I have the following code:
>
> __asm__ __volatile__ (
> ...
> "MyLabel: ..."
> ...
> : <output regs>
> : <input regs>
> : <clobber list>);
>
> Within the asm statement, I have to find somehow the address of label
> "MyLabel", in order to use it in one instruction. I looked through the
> archives but only found a solution if the label is defined outside the
> asm statement, where the '&&' operator and the "X" constraint can be
> used to pass that label into the asm statement. However, I can't
> figure out how to do it in my case. Any ideas?
If you have a label in assembly code, and you want to use it in
assembly code, then you need to write whatever is appropriate for your
assembly language (e.g., "mov #MyLabel,r0"). That is not really a
compiler issue.
If you have a label in assembly code, and you want to use it in C code
(e.g., by doing "goto MyLabel;"), then, sorry, you can't do that.
Ian