This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Forcing inline assembly code to be produced
- From: Kristis Makris <kristis dot makris at asu dot edu>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 23 Apr 2007 10:58:11 -0700
- Subject: Forcing inline assembly code to be produced
Hello,
I'm facing a problem producing inline assembly code in a C program. It
seems that when assembly code is added in a path that seems to be
unreachable (dead-code I suppose) the assembly code is not produced at
all. I'm using gcc 3.3.5 and as 2.15.
Is there a way to force such assembly code to be produced even though it
may be unreachable ? If not should there be a way ?
I'm attaching a simplified test case I'm using. I'm trying to generate a
symbol with inline assembly.
In a more complicated example, I'm trying to position uncommonly used
code in a separate memory region for better cache locality. One of the
inline assembly statements I'm using is not produced. This results in
not changing back to the ".text" section, resulting in further assembler
problems as described in:
http://lists.gnu.org/archive/html/bug-binutils/2007-04/msg00107.html
Thanks for any help.
Kristis
#include <stdio.h>
int main(void)
{
int a = 7;
goto there;
here:
exit(0);
there:
a++;
goto here;
asm ("some_label_that_i_really_want_produced:\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t"
"nop\n\t" );
}