On Tue, May 03, 2016 at 09:03:48PM +0100, Mark Cave-Ayland wrote:
So the optimiser has decided to remove the storage to/from the lr stack variable which of course means that the lr value isn't being preserved. Do I somehow need to mark the "r" (lr) as clobbered or something else?
Oh, yeah, that's another problem: a call can clobber all volatile (caller-save) registers. The best solution is to write this whole thing in actual assembler, instead of fighting the compiler to get just the assembler you want ;-)
Heh actually the bug was a missing volatile qualifier from the __context pointer which is interesting since this code is used almost boilerplate for other architectures - I'll spin up a patch to update the other archs once this has gone in. The v2 version of the patchset contains this correction though.
That is just a workaround. It might well work, and it can also break at any time.
Segher