xor r0, r0, r0
lis r3, 0x0000
Loop:
addi r3, r3, 0x0001
b Loop
When I run that through the powerpc-elf assembler, I receive the following
errors:
woo2.s: Assembler messages:
woo2.s:1: Error: unsupported relocation type
woo2.s:1: Error: unsupported relocation type
woo2.s:1: Error: unsupported relocation type
woo2.s:2: Error: unsupported relocation type
woo2.s:4: Error: unsupported relocation type
woo2.s:4: Error: unsupported relocation type
I assume this has something to do with register names. What goes in place
of r0 for general purpose registers? So far, I haven't had any luck digging
through the info or man pages. Am I using the correct assembler?
Thanks for any help,
Larry Lindsey
cmplw %r1,%r2
Regards
Andy Sinclair
> I assume this has something to do with register names. What goes in place
> of r0 for general purpose registers? So far, I haven't had any luck digging
> through the info or man pages. Am I using the correct assembler?
you can define
#define r0 0
#define r3 3
etc.
When you build a gcc ppc cross compiler the file ppc-asm.h with these defines
(and more) will be placed in a compiler system header file directory,
It can be included in your assembly source by means of #include <ppc-asm.h>.
Rob Windgassen
>On Mon, 10 Nov 2003 10:00:42 -0500, Larry Lindsey wrote:
>
>> I assume this has something to do with register names. What goes in place
>> of r0 for general purpose registers? So far, I haven't had any luck digging
>> through the info or man pages. Am I using the correct assembler?
>
>you can define
>
>#define r0 0
>#define r3 3
>etc.
This way is dangerous, because the following two opcodes are correct,
but a little typo ...
Typed:
addi r4,r4,r5 => addi 4,4,5 (correct)
But wanted:
add r4,r4,r5 => add 4,4,5 (correct)
but using
#define r0 %r0
#define r1 %r1
...
should work as well.
---
42Bastian
Do not email to bast...@yahoo.com, it's a spam-only account :-)
Use <same-name>@epost.de instead !
> This way is dangerous, because the following two opcodes are correct,
> but a little typo ...
> Typed:
> addi r4,r4,r5 => addi 4,4,5 (correct)
> But wanted:
> add r4,r4,r5 => add 4,4,5 (correct)
>
> but using
> #define r0 %r0
> #define r1 %r1
> should work as well.
You are right about the danger, but that won't go away with %r0, etc.
I just tried
foo:
add %r0,%r1,%r2
addi %r0,%r1,%r2
but that assembles without problem or warning (using binutils-2.14) into
00000000 <foo>:
0: 7c 01 12 14 add r0,r1,r2
4: 38 01 00 02 addi r0,r1,2
Rob Windgassen
Oh, damn, you just cut my safety net :(
(To be honest,I did not check it)