This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 4.5 powerpc wants r31
At 06:38 14.09.2011 -0700, Ian Lance Taylor wrote:
>Fabian Cenedese <Cenedese@indel.ch> writes:
>> register uint32 uFlags asm("r20") = 0;
>> asm volatile ("mr 31,%0": : "r" (uFlags) : "31");
>>
>> file.cpp:3271:1: error: 31 cannot be used in asm here
>>
>> 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.
This code is part of an embedded operating system. So of course
we'd like full control over all registers. After this register setting
is an asm jump to some other code, so r31 is not really used
for the C-code anymore.
I found that it works if I remove the clobber. That is good enough
as there's no more C-code that could look at the clobber.
Thanks
bye Fabi