Re: FW: Inline Assembler for PPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Martin Payne" <martin@xxxxxxxxxxxxxxx> writes:

> Well, that same code does not work for me.
> If I have this code:
> 
> main(int argc, char* argv[]) {
> 	int i;
> 	asm("stw %%r3, %0" : : "r" (i));
> 
> 	return 0;
> }
> 
> and compile it by running:
> 
> gcc mytest.c
> 
> it gives the following output:
> 
> /var/tmp//ccOB6jdo.s:16:Parameter syntax error (parameter 1)
> 
> I am using gcc 3.3 20030304 by Apple, build 1666.

OK, that error is coming from the assembler, not the compiler.  Note
that the file name is the .s file, not the .c file.

First I'll note that the error message is not from the mainline GNU
assembler.  My understanding is that Apple uses an assembler based on
very very old version of the GNU assembler.  I don't have access to
any Apple development systems.

That said, the above C source code will generate something like this
in the assembler file (you can check yourself by using the
--save-temps option to get the assembler file):
    stw %r3, 3
That of course won't work.  The stw instruction doesn't expect the
second parameter to be a register.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux