Re: GCC Inline assembly - immediate integer operand emit without $

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following example tries to create an elf section with three
integers using inline assembly.
    asm (".pushsection .test\n"
         ".long 0, %0, %1\n"
         ".popsection"
         :: "i"(ENUM_VAL2), "i"(2));

But it fails because gcc emits the assembly code with $.
Is there a way to instruct gcc to avoid emitting $?
    .pushsection .test
     .long 0, $1, $2 <<<<<<
     .popsection

    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.

Can't you just do this with attribute((section(".test")))?


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux