Trouble with inline asm on m68k

William A. Gatliff
Sat Jan 5 19:53:00 GMT 2002


Maybe it's just too late in the evening, maybe I'm just not reading
the info pages closely enough...

I'm trying to do this on a CPU32, m68k-elf-gcc (2.95.3):

int len;
__asm__ __volatile__ ("move.l %0, %d1" : : "r" (len) : "%d1");

[bgat@mars] m68k-elf-gcc -c -mcpu32 test.c
test.c:41: invalid 'asm': operand number out of range

Seems like gcc is getting tripped up on the %d1 in the opcode,
thinking it is an operand number instead of a register name.  Turning
the "%d1" into just "d1" makes gcc happy, but causes an unresolved
reference to "d1" at link time.  The assembler doesn't know it is a
register (which makes sense).

I'm binding to an asm API, so I have to call out the register name.

I can't be the first person to have this problem.  What's the solution?

Or better yet, what section of the infopages do I need to re-read?


Bill Gatliff

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list