Add HJ's -fomit-frame-pointer struct return fix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/libffi/ChangeLog.libffi b/libffi/ChangeLog.libffi
index e1df7c8..187daa1 100644
--- a/libffi/ChangeLog.libffi
+++ b/libffi/ChangeLog.libffi
@@ -1,3 +1,12 @@
+2008-01-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR libffi/34612
+ * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
+ returning struct.
+
+ * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer"
+ tests.
+
2008-01-30 Anthony Green <green@redhat.com>
* Makefile.am, include/Makefile.am: Move headers to
diff --git a/libffi/src/x86/sysv.S b/libffi/src/x86/sysv.S
index f22c939..a0daf1d 100644
--- a/libffi/src/x86/sysv.S
+++ b/libffi/src/x86/sysv.S
@@ -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
.Lcls_epilogue:
movl %ebp, %esp
popl %ebp
@@ -230,6 +232,10 @@ ffi_closure_SYSV:
movl (%ecx), %eax
movl 4(%ecx), %edx
jmp .Lcls_epilogue
+.Lcls_retstruct:
+ movl %ebp, %esp
+ popl %ebp
+ ret $4
.LFE2:
.size ffi_closure_SYSV, .-ffi_closure_SYSV
diff --git a/libffi/testsuite/libffi.call/call.exp b/libffi/testsuite/libffi.call/call.exp
index bd4d2e8..25e0109 100644
--- a/libffi/testsuite/libffi.call/call.exp
+++ b/libffi/testsuite/libffi.call/call.exp
@@ -27,6 +27,7 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" ""
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" ""
dg-finish