public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Fernandez <dfernandez@cct.co.uk>
To: "Ioannis E. Venetis" <venetis@capsl.udel.edu>
Cc: Ian Lance Taylor <iant@google.com>, gcc-help@gcc.gnu.org
Subject: Re: Address of label which is defined within an asm statement?
Date: Wed, 28 Jun 2006 16:00:00 -0000	[thread overview]
Message-ID: <1151510423.3070.13.camel@software.cct.co.uk> (raw)
In-Reply-To: <44A2960C.6040709@capsl.udel.edu>

On Wed, 2006-06-28 at 10:45 -0400, Ioannis E. Venetis wrote:
> Hello Ian,
> 
> Thanks for answering this. I need to access the address of the label 
> within the assembly code that I write. This means that I will have to 
> check again the documentation of this architecture. I hope that I will 
> find something.
> 
> Best regards,
> 
> Ioannis
> 
> > 
> > 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

To obtain the label address could be somthing like "mov #MyLabel, %<n>"
or "mov $MyLabel, %<n>" with <n> the output parameter number where you
get the result like : "=g" (MyLabelAddressVar).

To call a label from C code can be done using
	goto *MyLabelAddressVar
I think that is a C Extension feature of gcc... You cold also pass the
value to another assembler block to do the trick, but that would be
architectural dependent some way...
	"jmp *%0"
	:
	: "r" (MyLabelAddressVar)

David.

  reply	other threads:[~2006-06-28 16:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-27 18:37 Ioannis E. Venetis
2006-06-28  6:08 ` Ian Lance Taylor
2006-06-28 14:41   ` Ioannis E. Venetis
2006-06-28 16:00     ` David Fernandez [this message]
2006-06-28 22:28       ` Ioannis E. Venetis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1151510423.3070.13.camel@software.cct.co.uk \
    --to=dfernandez@cct.co.uk \
    --cc=gcc-help@gcc.gnu.org \
    --cc=iant@google.com \
    --cc=venetis@capsl.udel.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).