sysv/ms_abi attribute fix, part 1, sibcalls

H.J. Lu hjl.tools@gmail.com
Wed Dec 17 16:57:00 GMT 2008


On Wed, Dec 17, 2008 at 8:41 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Dec 14, 2008 at 3:29 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>>
>> 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)
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38556
>
>

I am testing this patch.

-- 
H.J.
---
2008-12-17  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/38556
	* calls.c (expand_call): Check outgoing_reg_parm_stack_space
	only if REG_PARM_STACK_SPACE is defined.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-foo-1.patch
Type: application/octet-stream
Size: 944 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081217/8b85b34c/attachment.obj>


More information about the Gcc-patches mailing list