loop in asm

Segher Boessenkool segher@kernel.crashing.org
Sun Nov 12 21:02:00 GMT 2006


> When I compiled it by "gcc -Wall 1.c", I did not get
> any compilation errors.
>
> But surprisingly I got compilation error when I
> compiled it by "gcc -O3 -Wall 1.c", I got comilation
> error saying that label .JIT already defined .

It inlined the function, but also kept a separate
copy because the function it is defined in isn't
static.

> How to solve it?

You can use local labels, for example

void fun()
{
asm volatile (" movl $0xFFFFFFFF, %%ecx;"
                 "0: loop 0b\n;"
                 :
                 :
                 :"%ecx");
}


Segher



More information about the Gcc-help mailing list