]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2003-09-09 Andreas Tobler <a.tobler@schweiz.ch>
authorAndreas Tobler <a.tobler@schweiz.ch>
Tue, 9 Sep 2003 17:37:53 +0000 (19:37 +0200)
committerAndreas Tobler <andreast@gcc.gnu.org>
Tue, 9 Sep 2003 17:37:53 +0000 (19:37 +0200)
* src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct
passing correctly.

From-SVN: r71238

libffi/ChangeLog
libffi/src/powerpc/ffi.c

index 19493bb2eed513dcf739c7bbe1bdc706f42b17f0..bc9f28a62a631a331e04d1aa7e84999ae844d4a8 100644 (file)
@@ -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.
index 30ab7efb0c60b29f7dc2a3808ac3ac9d87ffb876..010050f91ba2717f39336efa6b5af17a9c260436 100644 (file)
@@ -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: