ARM Xscale stack alignment

Ian Lance Taylor iant@google.com
Sat May 19 01:22:00 GMT 2007


Tom St Denis <tstdenis@ellipticsemi.com> writes:

> I need to get GCC to align all auto variables on an 8 byte boundary. 
> Which internally seems to be happening, but the stack frame is never
> 8-byte aligned (it is 4-byte aligned).  The problem is that on the
> xscale [e.g. PXA255] 64-bit loads are done in one memory reference which
> means that ifyou try to load a 64-bit variable that isn't 8-byte aligned
> you get a memory trap.
> 
> Is there a GCC switch or a patch I could use to ensure the stack frames
> are aligned properly?

If the stack pointer starts at an 8-byte boundary, gcc for XScale
should preserve that.  So you need to arrange for your startup file to
set an 8-byte boundary.  gcc doesn't have any way to do that itself.

Ian



More information about the Gcc-help mailing list