gcc 4.5 powerpc wants r31

Ian Lance Taylor iant@google.com
Wed Sep 14 13:39:00 GMT 2011


Fabian Cenedese <Cenedese@indel.ch> writes:

> Using a cross compiled gcc for PowerPC-CPUs: powerpc-eabi-gcc.exe --version
> powerpc-eabi-gcc.exe (crosstool-NG-1.8.2) 4.5.2
>
> I'm having a problem compiling some inline assembler code. This
> works with older compilers but 4.5 doesn't like it.
>
> register uint32 uFlags    asm("r20") = 0;
> asm volatile ("mr		31,%0": : "r" (uFlags) : "31");
>
> Compiling unoptimized I get
>
> file.cpp:3271:1: error: 31 cannot be used in asm here
>
> Compiling with -O2 works.
>
> Seems like this problem is already old (2006):
> https://bugs.gentoo.org/show_bug.cgi?format=multiple;id=133948
> http://www.stackless.com/pipermail/stackless/2006-August/002415.html
>
> Is there a solution apart from -fomit-frame-pointer or "don't do this"?

No.  If gcc is using the frame pointer, then it can't work correctly if
you clobber the frame pointer.  It's a feature that gcc is telling you
this.

Ian



More information about the Gcc-help mailing list