diff options
author | Ian Lance Taylor <iant@google.com> | 2012-11-06 23:04:28 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-11-06 23:04:28 +0000 |
commit | e808687a8ccc75ed362176302f88e96f59299db5 (patch) | |
tree | e9afce1a7b828481e60a55ca8c52c5871dfda253 /libgcc/generic-morestack.c | |
parent | b142d8a2b55117e93f0fa47f5ea65fd23c08f551 (diff) | |
download | gcc-e808687a8ccc75ed362176302f88e96f59299db5.zip gcc-e808687a8ccc75ed362176302f88e96f59299db5.tar.gz gcc-e808687a8ccc75ed362176302f88e96f59299db5.tar.bz2 |
generic-morestack.c (__generic_morestack): Align the returned stack pointer to a 32 byte boundary.
* generic-morestack.c (__generic_morestack): Align the returned
stack pointer to a 32 byte boundary.
* config/i386/morestack.S (__morestack_non_split) [32-bit]: Don't
increment the return address until we have decided that we don't
have a varargs function.
(__morestack) [32-bit]: Align stack correctly when calling C
functions.
(__morestack) [64-bit]: Likewise.
From-SVN: r193264
Diffstat (limited to 'libgcc/generic-morestack.c')
-rw-r--r-- | libgcc/generic-morestack.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libgcc/generic-morestack.c b/libgcc/generic-morestack.c index fad3d9b..89b2773 100644 --- a/libgcc/generic-morestack.c +++ b/libgcc/generic-morestack.c @@ -549,6 +549,7 @@ __generic_morestack (size_t *pframe_size, void *old_stack, size_t param_size) char *to; void *ret; size_t i; + size_t aligned; current = __morestack_current_segment; @@ -580,15 +581,19 @@ __generic_morestack (size_t *pframe_size, void *old_stack, size_t param_size) *pframe_size = current->size - param_size; + /* Align the returned stack to a 32-byte boundary. */ + aligned = (param_size + 31) & ~ (size_t) 31; + #ifdef STACK_GROWS_DOWNWARD { char *bottom = (char *) (current + 1) + current->size; - to = bottom - param_size; - ret = bottom - param_size; + to = bottom - aligned; + ret = bottom - aligned; } #else to = current + 1; - ret = (char *) (current + 1) + param_size; + to += aligned - param_size; + ret = (char *) (current + 1) + aligned; #endif /* We don't call memcpy to avoid worrying about the dynamic linker |