This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
labels in inline asm
- From: Clifford Wolf <clifford at clifford dot at>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 22 Nov 2007 01:21:54 +0100
- Subject: labels in inline asm
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.