summaryrefslogtreecommitdiff
path: root/src/prep_cif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/prep_cif.c')
-rw-r--r--src/prep_cif.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/prep_cif.c b/src/prep_cif.c
index e8ec5cf..e373cbd 100644
--- a/src/prep_cif.c
+++ b/src/prep_cif.c
@@ -76,6 +76,13 @@ static ffi_status initialize_aggregate(ffi_type *arg)
total size of 3*sizeof(long). */
arg->size = ALIGN (arg->size, arg->alignment);
+ /* On some targets, the ABI defines that structures have an additional
+ alignment beyond the "natural" one based on their elements. */
+#ifdef FFI_AGGREGATE_ALIGNMENT
+ if (FFI_AGGREGATE_ALIGNMENT > arg->alignment)
+ arg->alignment = FFI_AGGREGATE_ALIGNMENT;
+#endif
+
if (arg->size == 0)
return FFI_BAD_TYPEDEF;
else
@@ -146,7 +153,9 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
#ifdef XTENSA
&& (cif->rtype->size > 16)
#endif
-
+#ifdef NIOS2
+ && (cif->rtype->size > 8)
+#endif
)
bytes = STACK_ARG_SIZE(sizeof(void*));
#endif