sysv/ms_abi attribute fix, part 1, sibcalls

Jan Hubicka
Sun Dec 14 11:33:00 GMT 2008

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  <>
	Kai Tietz <>
	* 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)

More information about the Gcc-patches mailing list