This is the mail archive of the
libffi-discuss@sources.redhat.com
mailing list for the libffi project.
libffi Darwin support
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>, John Hornkvist <john at toastedmarshmallow dot com>
- Cc: libffi-discuss at sources dot redhat dot com
- Date: Tue, 27 Nov 2001 17:52:53 -0500
- Subject: libffi Darwin support
As was mentioned in the posting on libffi-discuss last January,
this is the same ABI as AIX (except for the lack of 64-bit support). I am
disappointed that it was added with the name Darwin all over the place,
especially when the original posting discusses unnecessary references to
SysV (:^).
The only non-portable aspects in the the assembly language are the
use of decorated register names instead of numbers and treating function
pointers as function addresses.
Also, the ABI description of long double is incorrect. 128-bit
long double is returned in registers fp1 and fp2, not as a structure with
a hidden parameter. I am not sure if the use of fp2 needs to be marked
somehow.
*** ffi_darwin.c Tue Oct 9 01:32:15 2001
--- ffi_darwin.c Tue Nov 27 17:15:42 2001
*************** ffi_status ffi_prep_cif_machdep(ffi_cif
*** 210,219 ****
- 64-bit integer values and structures between 5 and 8 bytes are returned
in gpr3 and gpr4;
- Single/double FP values are returned in fpr1;
! - Larger structures and long double (if not equivalent to double) values
! are allocated space and a pointer is passed as the first argument. */
switch (cif->rtype->type)
{
case FFI_TYPE_DOUBLE:
flags |= FLAG_RETURNS_64BITS;
/* Fall through. */
--- 210,225 ----
- 64-bit integer values and structures between 5 and 8 bytes are returned
in gpr3 and gpr4;
- Single/double FP values are returned in fpr1;
! - Long double FP (if not equivalent to double) values are returned in
! fpr1 and fpr2;
! - Larger structures values are allocated space and a pointer is passed
! as the first argument. */
switch (cif->rtype->type)
{
+ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+ case FFI_TYPE_LONGDOUBLE:
+ #endif
+ /* Fall through. */
case FFI_TYPE_DOUBLE:
flags |= FLAG_RETURNS_64BITS;
/* Fall through. */
*************** ffi_status ffi_prep_cif_machdep(ffi_cif
*** 227,236 ****
break;
case FFI_TYPE_STRUCT:
- /* Fall through. */
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
- case FFI_TYPE_LONGDOUBLE:
- #endif
flags |= FLAG_RETVAL_REFERENCE;
flags |= FLAG_RETURNS_NOTHING;
intarg_count++;
--- 233,238 ----