This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
inline asm outside functions
- From: Marc Tardif <marc at sitepak dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 28 Dec 2002 02:12:18 -0500
- Subject: inline asm outside functions
OS: Linux 2.4.13 i686
gcc: 2.96
It does not seem possible to define inline asm statements which specify
constraints outside of a function. For example, the following code will
generate an error:
__asm__ ( \
" .align 4\n" \
".globl foo\n" \
" .type foo,@function\n" \
"foo:\n" \
" movl %0, %%eax\n" \
" jmp *(%%eax)\n" \
: /* no output */ \
: "n" (offset));
The error generated is:
parse error before `:'
The hacked solution to this problem is to create a dummy function
surrounding the inline asm statement.
Marc - Sitepak