GCC Inline assembly - immediate integer operand emit without $

Segher Boessenkool segher@kernel.crashing.org
Mon Sep 3 04:16:00 GMT 2012


>>     asm (".pushsection .test\n"
>>          ".long 0, %P0, %P1\n"
>>
>>          ".popsection"
>>          :: "i"(ENUM_VAL2), "i"(2));
>>
>> but this is quite hackish, %P isn't meant for this.  On newer GCC
>> versions there is %p, which is better.
>
> Thanks - it is what exactly I wanted.

I knew I forgot something :-)  Please use "%c0" instead, which works
on every GCC version, and is portable even.


Segher



More information about the Gcc-help mailing list