diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-25 20:48:19 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-25 20:48:19 +0000 |
commit | 4bb0c596e8085b8207ba7d756c404f474115c877 (patch) | |
tree | 9b7c31e86ff93c95ed67b963d17e16527d404ce4 /libgcc | |
parent | eaf1e5768d9418a24b0da872017e2f0882dc015b (diff) | |
download | gcc-4bb0c596e8085b8207ba7d756c404f474115c877.tar.gz |
libgcc/:
* config/i386/morestack.S (__morestack_non_split): Check whether
caller is varargs and needs %bp to hold the stack frame on return.
gcc/testsuite/:
* gcc.dg/split-6.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187894 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 11 | ||||
-rw-r--r-- | libgcc/config/i386/morestack.S | 42 |
2 files changed, 45 insertions, 8 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index db4c801580e..5c048f53149 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2012-05-25 Ian Lance Taylor <iant@google.com> + + * config/i386/morestack.S (__morestack_non_split): Check whether + caller is varargs and needs %bp to hold the stack frame on return. + 2012-05-25 Olivier Hainque <hainque@adacore.com> * config/rs6000/vxworks/tramp.S (trampoline_setup): Use a longcall @@ -80,9 +85,9 @@ 2012-04-28 Aurelien Jarno <aurelien@aurel32.net> - * config.host (mips64*-*-linux*, mipsisa64*-*-linux*): Remove. - (mips*-*-linux*): Include mips/t-tpbit when long double is - 16 bytes long. + * config.host (mips64*-*-linux*, mipsisa64*-*-linux*): Remove. + (mips*-*-linux*): Include mips/t-tpbit when long double is + 16 bytes long. 2012-04-25 Sriraman Tallam <tmsriram@google.com> diff --git a/libgcc/config/i386/morestack.S b/libgcc/config/i386/morestack.S index 62f7ce1c0f7..228d6901abd 100644 --- a/libgcc/config/i386/morestack.S +++ b/libgcc/config/i386/morestack.S @@ -1,5 +1,5 @@ # x86/x86_64 support for -fsplit-stack. -# Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Contributed by Ian Lance Taylor <iant@google.com>. # This file is part of GCC. @@ -138,6 +138,24 @@ __morestack_non_split: je 1f # see above. addl $2,%eax 1: inc %eax + + # If the instruction that we return to is + # leal 20(%ebp),{%eax,%ecx,%edx} + # then we have been called by a varargs function that expects + # %ebp to hold a real value. That can only work if we do the + # full stack split routine. FIXME: This is fragile. + cmpb $0x8d,(%eax) + jne 3f + cmpb $0x14,2(%eax) + jne 3f + cmpb $0x45,1(%eax) + je 2f + cmpb $0x4d,1(%eax) + je 2f + cmpb $0x55,1(%eax) + je 2f + +3: movl %eax,4(%esp) # Update return address. popl %eax # Restore %eax and stack. @@ -175,18 +193,32 @@ __morestack_non_split: #else cmpl %fs:0x40,%eax #endif - popq %rax # Restore register. - - .cfi_adjust_cfa_offset -8 # Adjust for popped register. jb 2f # Get more space if we need it. # This breaks call/return prediction, as described above. - incq (%rsp) # Increment the return address. + incq 8(%rsp) # Increment the return address. + + # If the instruction that we return to is + # leaq 24(%rbp), %r11n + # then we have been called by a varargs function that expects + # %ebp to hold a real value. That can only work if we do the + # full stack split routine. FIXME: This is fragile. + movq 8(%rsp),%rax + cmpl $0x185d8d4c,(%rax) + je 2f + + popq %rax # Restore register. + + .cfi_adjust_cfa_offset -8 # Adjust for popped register. ret # Return to caller. 2: + popq %rax # Restore register. + + .cfi_adjust_cfa_offset -8 # Adjust for popped register. + addq $0x5000+BACKOFF,%r10 # Increment space we request. # Fall through into morestack. |