This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: problem passing constants to inline asm
- From: Ian Lance Taylor <ian at airs dot com>
- To: Stas Sergeev <stsp at aknet dot ru>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 23 May 2006 22:37:28 -0700
- Subject: Re: problem passing constants to inline asm
- References: <4471F10E.2010500@aknet.ru>
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