This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
sysv/ms_abi attribute fix, part 1, sibcalls
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, iant at google dot com
- Date: Sun, 14 Dec 2008 12:29:36 +0100
- Subject: sysv/ms_abi attribute fix, part 1, sibcalls
Hi,
this series of patches should make sysv/ms_abi attributes in i386 working well
enough to get working wine64 binary.
This patch prevents GCC from making cross-ABI sibcalls. When
OUTGOING_REG_PARM_STACK_SPACE does not match, the frame layout in caller and
callee differs and we can not return back properly.
Bootstrapped/regtested x86_64-linux, OK?
Jan Hubicka <jh@suse.cz>
Kai Tietz <kai.tietz@onevision.com>
* calls.c (expand_call): Do not sibcall if
outgoing_reg_parm_stack_space does not match.
Index: calls.c
===================================================================
*** calls.c (revision 142597)
--- calls.c (working copy)
*************** expand_call (tree exp, rtx target, int i
*** 2298,2303 ****
--- 2298,2307 ----
It does not seem worth the effort since few optimizable
sibling calls will return a structure. */
|| structure_value_addr != NULL_RTX
+ /* If outgoing reg parm stack space changes, we can not do sibcall. */
+ || (OUTGOING_REG_PARM_STACK_SPACE (funtype)
+ != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl)))
+ || (reg_parm_stack_space != REG_PARM_STACK_SPACE (fndecl))
/* Check whether the target is able to optimize the call
into a sibcall. */
|| !targetm.function_ok_for_sibcall (fndecl, exp)