Fix passing floating point arguments on 64bits SPARC (libffi#778) (#802)
authorPetr Sumbera <sumbera@volny.cz>
Sat, 21 Oct 2023 11:42:11 +0000 (13:42 +0200)
committerGitHub <noreply@github.com>
Sat, 21 Oct 2023 11:42:11 +0000 (07:42 -0400)
src/sparc/ffi64.c

index 5ae43e87d0a2842cdbc5eaada39519180d72a9e7..7a9dc3283b5717ee66dcf9338c7951cf64363211 100644 (file)
@@ -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;