Q about stack alignment on PowerPC.

Sergei Organov osv at javad.ru
Fri Sep 22 15:48:16 UTC 2000


Hello,

Both SysV ABI and EABI for PowerPC specify stack pointer alignment
restrictions (16 and 8 bytes, respectively). Where in RTEMS sources is this
alignment assured? I can't find it. Neither for initial values of stack
pointers for tasks nor for interrupt one :-(

Note that violation of the alignment requirements may result in very odd
behavior using gcc versions 2.95 and newer. E.g., calling 'printf' with more
than 8 double arguments will print 9th argument right when invoked from one
task, and will print garbage when invoked from another. This is due to changes
in 'va_arg' to align addresses of doubles passed on stack on 8 bytes
boundary. Code generated by earlier versions of gcc used to work without any
visible problems with stack pointers aligned on 4 bytes boundary.

Thanks in advance.

Sergei.




More information about the users mailing list