I am porting some code from that originally compiles with a GCC 3 series compiler for the NIOS2 architecture. Porting it to GCC 4.8.2. I get errors: "error: matching constraint references invalid operand number" from a lot of inline asm code.
The errors are coming from the input-line of the inline asm (after second colon). I've tried searching and have not managed to find what kind of register 'D' refers to (does not seem to be a standard constraint, nor is it listed as an architecture specific one for NIOS2). The errors refer to the numbers but am even more confused about the numbers and what they refer to, I know they are called matching constraints and are related to matching the instruction operands but trap does not have any operands...? I can make the errors disappear if I change the number to range from 1-4 in this case but I need to understand what it does and what has changed in GCC. I read all the migration guides for all the intermediate versions and didn't see anything related.
Edit: Also not sure what the "callno" refers to.
#define POS_SYSCALL(R,N,P,A,B) \
__asm__ volatile ("trap\n" \
: "=r"(R), "=r"(N), "=r"(P), "=r"(A), "=r"(B) \
: [callno]"D04"(N), "D05"(P), "D06"(A), "D07"(B) \
: "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "memory");
__inline__
int syscall(int callnr, int param, void * a, void * b)
{
register int result __asm__("r2");
register int arg0 __asm__("r5") = (int)param;
register void * arga __asm__("r6") = a;
register void * argb __asm__("r7") = b;
POS_SYSCALL(result, callnr, arg0, arga, argb);
return result;
}