aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Tobler <a.tobler@schweiz.ch>2003-09-09 19:37:53 +0200
committerAndreas Tobler <andreast@gcc.gnu.org>2003-09-09 19:37:53 +0200
commit086a4bd7ddda8e5ac0faeee217f6ff5564bb1b4f (patch)
treec28314a33b91f14b646d643523e7ac75c39fa73d
parentf09859008013c74a6b5d2530232216a3965278d3 (diff)
downloadgcc-086a4bd7ddda8e5ac0faeee217f6ff5564bb1b4f.zip
gcc-086a4bd7ddda8e5ac0faeee217f6ff5564bb1b4f.tar.gz
gcc-086a4bd7ddda8e5ac0faeee217f6ff5564bb1b4f.tar.bz2
2003-09-09 Andreas Tobler <a.tobler@schweiz.ch>
* src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct passing correctly. From-SVN: r71238
-rw-r--r--libffi/ChangeLog5
-rw-r--r--libffi/src/powerpc/ffi.c16
2 files changed, 19 insertions, 2 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 19493bb..bc9f28a 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-09 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct
+ passing correctly.
+
2003-09-09 Alan Modra <amodra@bigpond.net.au>
* configure: Regenerate.
diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c
index 30ab7ef..010050f 100644
--- a/libffi/src/powerpc/ffi.c
+++ b/libffi/src/powerpc/ffi.c
@@ -853,8 +853,7 @@ ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue,
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_POINTER:
- case FFI_TYPE_STRUCT:
- /* there are 8 gpr registers used to pass values */
+ /* there are 8 gpr registers used to pass values */
if (ng < 8) {
avalue[i] = pgr;
ng++;
@@ -864,6 +863,19 @@ ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue,
pst++;
}
break;
+
+ case FFI_TYPE_STRUCT:
+ /* Structs are passed by reference. The address will appear in a
+ gpr if it is one of the first 8 arguments. */
+ if (ng < 8) {
+ avalue[i] = (void *) *pgr;
+ ng++;
+ pgr++;
+ } else {
+ avalue[i] = (void *) *pst;
+ pst++;
+ }
+ break;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64: