aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2011-03-07 21:47:10 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-03-07 21:47:10 +0000
commit457186f6d55cc813cdb1cdcbfd75457930dacbd2 (patch)
tree81db746c26ee9cb9243c5204593fc2d98b7950f0 /libgcc
parentc7e529d3bc34424e0b0686854f2a4db42286ea9c (diff)
downloadgcc-457186f6d55cc813cdb1cdcbfd75457930dacbd2.zip
gcc-457186f6d55cc813cdb1cdcbfd75457930dacbd2.tar.gz
gcc-457186f6d55cc813cdb1cdcbfd75457930dacbd2.tar.bz2
generic-morestack.c (__splitstack_find): Adjust returned stack pointer to include all registers pushed by __morestack.
* generic-morestack.c (__splitstack_find): Adjust returned stack pointer to include all registers pushed by __morestack. From-SVN: r170757
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog5
-rw-r--r--libgcc/generic-morestack.c24
2 files changed, 19 insertions, 10 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 3368dec..4092218 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-07 Ian Lance Taylor <iant@google.com>
+
+ * generic-morestack.c (__splitstack_find): Adjust returned stack
+ pointer to include all registers pushed by __morestack.
+
2011-01-26 Dave Korn <dave.korn.cygwin@gmail.com>
PR target/40125
diff --git a/libgcc/generic-morestack.c b/libgcc/generic-morestack.c
index 3709d32..7e29bbc 100644
--- a/libgcc/generic-morestack.c
+++ b/libgcc/generic-morestack.c
@@ -1,5 +1,5 @@
/* Library support for -fsplit-stack. */
-/* Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor <iant@google.com>.
This file is part of GCC.
@@ -846,20 +846,24 @@ __splitstack_find (void *segment_arg, void *sp, size_t *len,
parameters <- old_stack
return in f1
return in f2
- data pushed by __morestack
+ registers pushed by __morestack
- On x86, the data pushed by __morestack includes the saved value
- of the ebp/rbp register. We want our caller to be able to see
- that value, which can not be found on any other stack. So we
- adjust accordingly. This may need to be tweaked for other
- targets. */
+ The registers pushed by __morestack may not be visible on any
+ other stack, if we are being called by a signal handler
+ immediately after the call to __morestack_unblock_signals. We
+ want to adjust our return value to include those registers. This
+ is target dependent. */
nsp = (char *) segment->old_stack;
-#ifdef STACK_GROWS_DOWNWARD
- nsp -= 3 * sizeof (void *);
+
+#if defined (__x86_64__)
+ nsp -= 12 * sizeof (void *);
+#elif defined (__i386__)
+ nsp -= 6 * sizeof (void *);
#else
- nsp += 3 * sizeof (void *);
+#error "unrecognized target"
#endif
+
*next_sp = (void *) nsp;
#ifdef STACK_GROWS_DOWNWARD