summaryrefslogtreecommitdiff
path: root/libffi/src/sh
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2005-07-20 23:32:01 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2005-07-20 23:32:01 +0000
commit5d0317fccc05045d73439d30afb00cb710fa9a82 (patch)
treee730225b648228a800a11c7a0182daab21d52360 /libffi/src/sh
parent3a664c1c0057af42505542782c1a49eecce5597e (diff)
downloadgcc-5d0317fccc05045d73439d30afb00cb710fa9a82.tar.gz
ffi.c (ffi_call): Handle small structures correctly.
* src/sh/ffi.c (ffi_call): Handle small structures correctly. Remove empty line. * src/sh64/ffi.c (simple_type): Remove. (return_type): Handle small structures correctly. (ffi_prep_args): Likewise. (ffi_call): Likewise. (ffi_closure_helper_SYSV): Likewise. * src/sh64/sysv.S (ffi_call_SYSV): Handle 1, 2 and 4-byte return. Emit position independent code if PIC and remove wrong datalabel prefixes from EH data. From-SVN: r102210
Diffstat (limited to 'libffi/src/sh')
-rw-r--r--libffi/src/sh/ffi.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libffi/src/sh/ffi.c b/libffi/src/sh/ffi.c
index 2045419df7c..ddf562f048a 100644
--- a/libffi/src/sh/ffi.c
+++ b/libffi/src/sh/ffi.c
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
- ffi.c - Copyright (c) 2002, 2003, 2004 Kaz Kojima
+ ffi.c - Copyright (c) 2002, 2003, 2004, 2005 Kaz Kojima
SuperH Foreign Function Interface
@@ -427,6 +427,7 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
/*@dependent@*/ void **avalue)
{
extended_cif ecif;
+ UINT64 trvalue;
ecif.cif = cif;
ecif.avalue = avalue;
@@ -434,7 +435,10 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
/* If the return value is a struct and we don't have a return */
/* value address then we need to make one */
- if ((rvalue == NULL) &&
+ if (cif->rtype->type == FFI_TYPE_STRUCT
+ && return_type (cif->rtype) != FFI_TYPE_STRUCT)
+ ecif.rvalue = &trvalue;
+ else if ((rvalue == NULL) &&
(cif->rtype->type == FFI_TYPE_STRUCT))
{
/*@-sysunrecog@*/
@@ -443,7 +447,6 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
}
else
ecif.rvalue = rvalue;
-
switch (cif->abi)
{
@@ -457,6 +460,11 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
FFI_ASSERT(0);
break;
}
+
+ if (rvalue
+ && cif->rtype->type == FFI_TYPE_STRUCT
+ && return_type (cif->rtype) != FFI_TYPE_STRUCT)
+ memcpy (rvalue, &trvalue, cif->rtype->size);
}
extern void ffi_closure_SYSV (void);