OSDN Git Service

2003-09-09 Andreas Tobler <a.tobler@schweiz.ch>
authorandreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2003 17:37:53 +0000 (17:37 +0000)
committerandreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2003 17:37:53 +0000 (17:37 +0000)
* src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct
passing correctly.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71238 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 19493bb..bc9f28a 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 30ab7ef..010050f 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: