labels in inline asm

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

 



Hi,

sorry for asking a probably dump question. I'm trying to port SDL_gfx
2.0.16 to ROCK Linux atm and running into a problem wich boils down to the
following test case:

--snip--
inline void foobar()
{
        asm volatile(
                "jz .foobar_label\n"
                ".foobar_label:\n"
                "nop"
        );
}

int main()
{
        foobar();
        foobar();
        return 0;
}
--snap--

when compiled with optimization (inlining enabled) this sure results in an
assembler file with the .foobar_label defined three times:

	# gcc -O2 -c demo.c
	/tmp/ccx1Ibd9.s: Assembler messages:
	/tmp/ccx1Ibd9.s:29: Error: symbol `.foobar_label' is already defined
	/tmp/ccx1Ibd9.s:32: Error: symbol `.foobar_label' is already defined

maybe I'm just blind but I cant find anything in the gcc info page which
provides me with a mechanism for dynamically creating label prefixes or
something like that which would help me generating different labels in each
instances of the assembler template...

please help.

yours,
 - clifford

-- 
When your hammer is C++, everything begins to look like a thumb.

[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