[patch libffi]: Fix _ffi_call_win64 stack allocation

Kai Tietz ktietz70@googlemail.com
Mon Sep 28 18:57:00 GMT 2009


Hello,

this patch fixes a stack allocation bug in _ffi_call_win64. The issue
is that the stack was one time allocated by ___chkstk and then again
stack was probed and allocated by a random value of %rax. Gcc's
___chkstk isn't the same as VC's. VC's version just probes the given
size in %rax on stack, but doesn't allocate it, but gcc's version
probes and allocates. Also VC's version doesn't clobber any register,
but gcc's version clobbers rax, r10, and r11. For more details see
gcc/config/i386/cygwin.asm file.

ChangeLog

2009-09-28  Kai Tietz  <kai.tietz@onevision.com>

	* src/x86/win64.S (_ffi_call_win64 stack): Remove for gnu
	assembly version use of ___chkstk.

Tested for x86_64-pc-mingw32 without regressions. Ok for apply?

Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libffi_w64.diff
Type: application/octet-stream
Size: 547 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090928/477b72d7/attachment.obj>


More information about the Gcc-patches mailing list