[LLVMdev] Stack alignment in JIT compiled code

Andrew Haley aph at redhat.com
Fri May 1 07:27:58 PDT 2009

Corrado Zoccolo wrote:
> On Linux x86_64, it is different. The x86-64 ABI says
> (http://www.x86-64.org/viewvc/trunk/x86-64-ABI/low-level-sys-info.tex?revision=84&content-type=text%2Fplain):
> The end of the input argument area shall be aligned on a 16 byte boundary.
> In other words, the value (%rsp - 8) is always a multiple of 16 when control is
> transferred to the function entry point. The stack pointer, %rsp,
> always points to
> the end of the latest allocated stack frame.
> <<
> The libc itself assumes it in that way, and does no stack realignment.

That's right.  If you want to be able to call any code produced by gcc,
you have to preserve 16-alignment.  gcc-generated code does not realign
the stack pointer.


More information about the llvm-dev mailing list