I have this C macro:
#define syscall(number) \
({ \
asm volatile ( \
".set noreorder\n" \
"nop\n" \
"syscall "#number"\n" \
);\
})
It works great when I call it with integer:
syscall(5);
However when I do something like this:
#define SYSCALL_PUTC 5
syscall(SYSCALL_PUTC);
I get this error:
Error: Instruction syscall requires absolute expression
How do I work around this? I don't want to have my code littered with magic numbers.
Use stringification like this:
For more info on stringification, see this gcc page:
http://gcc.gnu.org/onlinedocs/cpp/Stringification.html