summaryrefslogtreecommitdiff
blob: 3768df62df9fd05373fced4598d94f693ab84fa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
https://github.com/libffi/libffi/issues/778
https://bugs.gentoo.org/882071

Fix incorrect type for passing floats. Thanks to Petr Sumbera and Richard Henderson
for figuring it out on the upstream bug.
--- a/src/sparc/ffi64.c
+++ b/src/sparc/ffi64.c
@@ -382,13 +382,19 @@ ffi_prep_args_v9(ffi_cif *cif, unsigned long *argp, void *rvalue, void **avalue)
 	  *argp++ = *(SINT32 *)a;
 	  break;
 	case FFI_TYPE_UINT32:
-	case FFI_TYPE_FLOAT:
 	  *argp++ = *(UINT32 *)a;
 	  break;
 	case FFI_TYPE_SINT64:
 	case FFI_TYPE_UINT64:
 	case FFI_TYPE_POINTER:
+          *argp++ = *(UINT64 *)a;
+          break;
+       case FFI_TYPE_FLOAT:
+          flags |= SPARC_FLAG_FP_ARGS;
+          *argp++ = *(UINT32 *)a;
+          break;
 	case FFI_TYPE_DOUBLE:
+          flags |= SPARC_FLAG_FP_ARGS;
 	  *argp++ = *(UINT64 *)a;
 	  break;