diff options
author | Nate Begeman <natebegeman@mac.com> | 2006-04-25 20:54:26 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2006-04-25 20:54:26 +0000 |
commit | 4530327c046080f02fd5d50eb86eee965d10adf3 (patch) | |
tree | e134ccb7b3dfe19c84e4988cc50174c986bf28b0 /llvm/lib/Target | |
parent | a9467aab0ab0902101326f71af6e225c307a7233 (diff) | |
download | bcm5719-llvm-4530327c046080f02fd5d50eb86eee965d10adf3.tar.gz bcm5719-llvm-4530327c046080f02fd5d50eb86eee965d10adf3.zip |
Keep the stack from on darwin 16-byte aligned. This fixes many JIT
failres.
llvm-svn: 27973
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/X86JITInfo.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86JITInfo.cpp b/llvm/lib/Target/X86/X86JITInfo.cpp index 5cf3b728cc8..19ff68bd8f7 100644 --- a/llvm/lib/Target/X86/X86JITInfo.cpp +++ b/llvm/lib/Target/X86/X86JITInfo.cpp @@ -59,8 +59,19 @@ extern "C" { "movl %esp, %ebp\n" // Standard prologue "pushl %eax\n" "pushl %edx\n" // save EAX/EDX -#if defined(__CYGWIN__) || defined(__APPLE__) - "call _X86CompilationCallback2\n" +#if defined(__CYGWIN__) + "call _X86CompilationCallback2\n" +#elif defined(__APPLE__) + "movl 4(%ebp), %eax\n" // load the address of return address + "movl $24, %edx\n" // if the opcode of the instruction at the + "cmpb $-51, (%eax)\n" // return address is our 0xCD marker, then + "movl $12, %eax\n" // subtract 24 from %esp to realign it to 16 + "cmovne %eax, %edx\n" // bytes after the push of edx, the amount to. + "subl %edx, %esp\n" // the push of edx to keep it aligned. + "pushl %edx\n" // subtract. Otherwise, subtract 12 bytes after + "call _X86CompilationCallback2\n" + "popl %edx\n" + "addl %edx, %esp\n" #else "call X86CompilationCallback2\n" #endif |