aboutsummaryrefslogtreecommitdiff
path: root/libffi/src/powerpc
diff options
context:
space:
mode:
authorAndreas Tobler <a.tobler@schweiz.ch>2003-09-09 17:37:53 +0000
committerAndreas Tobler <a.tobler@schweiz.ch>2003-09-09 17:37:53 +0000
commit0216af902f3010f5fcc569287d504bc54f49459f (patch)
treec28314a33b91f14b646d643523e7ac75c39fa73d /libffi/src/powerpc
parente37892dc4e6f1f2d2b313810078368e078d3eff1 (diff)
2003-09-09 Andreas Tobler <a.tobler@schweiz.ch>
* src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct passing correctly. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@71238 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi/src/powerpc')
-rw-r--r--libffi/src/powerpc/ffi.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c
index 30ab7efb0c6..010050f91ba 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: