aboutsummaryrefslogtreecommitdiff
path: root/libffi/src/powerpc/ffi.c
diff options
context:
space:
mode:
Diffstat (limited to 'libffi/src/powerpc/ffi.c')
-rw-r--r--libffi/src/powerpc/ffi.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c
index 257f02fab3e..26f7cf19b06 100644
--- a/libffi/src/powerpc/ffi.c
+++ b/libffi/src/powerpc/ffi.c
@@ -127,6 +127,9 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
int i;
ffi_type **ptr;
+#ifndef __NO_FPRS__
+ double double_tmp;
+#endif
union {
void **v;
char **c;
@@ -146,7 +149,6 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS;
intarg_count = 0;
#ifndef __NO_FPRS__
- double double_tmp;
fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS;
fparg_count = 0;
copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c);
@@ -542,11 +544,12 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
{
char *where = next_arg.c;
+#ifndef __LITTLE_ENDIAN__
/* Structures with size less than eight bytes are passed
left-padded. */
if ((*ptr)->size < 8)
where += 8 - (*ptr)->size;
-
+#endif
memcpy (where, *p_argv.c, (*ptr)->size);
next_arg.ul += words;
if (next_arg.ul == gpr_end.ul)
@@ -1208,6 +1211,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
+#ifndef __LITTLE_ENDIAN__
/* there are 8 gpr registers used to pass values */
if (ng < 8)
{
@@ -1221,9 +1225,10 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
pst++;
}
break;
-
+#endif
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
+#ifndef __LITTLE_ENDIAN__
/* there are 8 gpr registers used to pass values */
if (ng < 8)
{
@@ -1237,7 +1242,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
pst++;
}
break;
-
+#endif
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_POINTER:
@@ -1367,22 +1372,25 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
{
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
+#ifndef __LITTLE_ENDIAN__
avalue[i] = (char *) pst + 7;
pst++;
break;
-
+#endif
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
+#ifndef __LITTLE_ENDIAN__
avalue[i] = (char *) pst + 6;
pst++;
break;
-
+#endif
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
+#ifndef __LITTLE_ENDIAN__
avalue[i] = (char *) pst + 4;
pst++;
break;
-
+#endif
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_POINTER:
@@ -1391,11 +1399,13 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
break;
case FFI_TYPE_STRUCT:
+#ifndef __LITTLE_ENDIAN__
/* Structures with size less than eight bytes are passed
left-padded. */
if (arg_types[i]->size < 8)
avalue[i] = (char *) pst + 8 - arg_types[i]->size;
else
+#endif
avalue[i] = pst;
pst += (arg_types[i]->size + 7) / 8;
break;