inline asm literal constraints

Marc Tardif marc@sitepak.com
Fri Dec 27 23:08:00 GMT 2002


OS: Linux 2.4.13 i686
gcc: 2.96

When defining inline asm statements, it does not seem possible to 
specify literal constraints. For example, if I have the variable 
"offset" which contains the value "4", there is no way to use this 
literal value in the following:

asm ("jmp *%0(%eax)" : : "n" (offset));

This will generate the following code, which is incorrect:

jmp *$4(%eax)

Instead, this should generate the following code:

jmp *4(%eax)

The problem is that there doesn't seem to be a constraint variable for 
specifying literal values instead of immediate values.

Marc - Sitepak



More information about the Gcc-bugs mailing list