This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR libffi/34612: libffi doesn't work with -fomit-frame-pointer on ia32

According ia32 psABI, we should pop 4 byte from stack when returning
struct. This patch does it and add tests for -fomit-frame-pointer.
Tested on Linux/ia32.

2007-12-29  H.J. Lu  <>

	PR libffi/34612
	* src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
	returning struct.

	* testsuite/ Add "-O2 -fomit-frame-pointer"

--- libffi/src/x86/sysv.S.frame	2007-08-07 14:48:04.000000000 -0700
+++ libffi/src/x86/sysv.S	2007-12-29 06:55:51.000000000 -0800
@@ -210,6 +210,8 @@ ffi_closure_SYSV:
 	je	.Lcls_retldouble
 	cmpl	$FFI_TYPE_SINT64, %eax
 	je	.Lcls_retllong
+	cmpl	$FFI_TYPE_STRUCT, %eax
+	je	.Lcls_retstruct
 	movl	%ebp, %esp
 	popl	%ebp
@@ -230,6 +232,10 @@ ffi_closure_SYSV:
 	movl	(%ecx), %eax
 	movl	4(%ecx), %edx
 	jmp	.Lcls_epilogue
+	movl	%ebp, %esp
+	popl	%ebp
+	ret	$4
 	.size	ffi_closure_SYSV, .-ffi_closure_SYSV
--- libffi/testsuite/	2006-11-18 06:27:24.000000000 -0800
+++ libffi/testsuite/	2007-12-29 06:33:36.000000000 -0800
@@ -27,6 +27,7 @@ dg-runtest [lsort [glob -nocomplain $src
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" ""
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" ""
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" ""
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" ""

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]