public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem passing constants to inline asm
@ 2006-05-22 17:12 Stas Sergeev
  2006-05-24  5:37 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Stas Sergeev @ 2006-05-22 17:12 UTC (permalink / raw)
  To: gcc-help

Hi.

I am trying to write something like this:

  asm volatile (".space %0\n" :: "i"(sizeof(var)));

but this doesn't work because "i" prepends the number
with the $ sign.
I've only found the following hack to cheat gcc:

  asm volatile (".space %0\n" :: "m"(*(long*)sizeof(var)));

but that's quite nasty and doesn't work with -O0.

So, what is the right way of passing the constants to those
"Special Dot Symbols" of gas?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problem passing constants to inline asm
  2006-05-22 17:12 problem passing constants to inline asm Stas Sergeev
@ 2006-05-24  5:37 ` Ian Lance Taylor
  2006-05-24 16:36   ` Stas Sergeev
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2006-05-24  5:37 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: gcc-help

Stas Sergeev <stsp@aknet.ru> writes:

> I am trying to write something like this:
> 
>   asm volatile (".space %0\n" :: "i"(sizeof(var)));
> 
> but this doesn't work because "i" prepends the number
> with the $ sign.
> I've only found the following hack to cheat gcc:
> 
>   asm volatile (".space %0\n" :: "m"(*(long*)sizeof(var)));
> 
> but that's quite nasty and doesn't work with -O0.
> 
> So, what is the right way of passing the constants to those
> "Special Dot Symbols" of gas?

Try %c0.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problem passing constants to inline asm
  2006-05-24  5:37 ` Ian Lance Taylor
@ 2006-05-24 16:36   ` Stas Sergeev
  0 siblings, 0 replies; 3+ messages in thread
From: Stas Sergeev @ 2006-05-24 16:36 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Ian Lance Taylor wrote:
>> So, what is the right way of passing the constants to those
>> "Special Dot Symbols" of gas?
> Try %c0.
Thank you!
That's something that looks difficult to find in the gcc docs
though (if it is there at all).

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-24 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-22 17:12 problem passing constants to inline asm Stas Sergeev
2006-05-24  5:37 ` Ian Lance Taylor
2006-05-24 16:36   ` Stas Sergeev

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).