[Patch,libffi] Add MIPS64 soft-float support to libffi.
David Daney
ddaney@caviumnetworks.com
Fri Aug 28 17:56:00 GMT 2009
libffi is lacking support for the mips64 soft-float ABIs. In addition
be being annoying in and of itself, it also causes libjava failures.
The patch adds soft-float support for both n32 and n64 ABIs. Quite a
bit of code had to be touched as the rules for passing structures
containing floating point elements are a slightly complex.
While working on the patch I noticed that we were failing a bunch if
pointer passing test cases that where recently added. It turns out that
the original closure support for returning pointers was incorrect and
this was unmasked by the new test cases. I wrapped fixes for this into
the patch as well (Yes, I know it is technically a no-no). The change
to ffi_java_raw_to_rvalue() is needed with with the fixed closure
pointer return.
I would like to add that I think there is still incorrect handling for
values of most types on big-endian systems in java_raw_api.c, but since
the java interpreter only uses a couple of types, the problematical
cases are never used.
The end result is that all libffi tests except for some long double
things now pass at -O0. There are a couple of floating point failures
with optimization turned on, but they look like they may be issues with
libgcc's soft-float support. The long double FAILures seem to be due
to lack of support in my glibc's printf.
Tested on mips64-unknown-linux-gnu soft-float with both n32 and n64 ABIs
with no regressions. Currently testing mips64-unknown-linux-gnu
hard-float n32 and n64.
OK to commit given the hard-float testing is good?
2009-08-28 David Daney <ddaney@caviumnetworks.com>
* src/java_raw_api.c (ffi_java_raw_to_rvalue): Remove special
handling for FFI_TYPE_POINTER.
* src/mips/ffitarget.h (FFI_TYPE_STRUCT_D_SOFT,
FFI_TYPE_STRUCT_F_SOFT, FFI_TYPE_STRUCT_DD_SOFT,
FFI_TYPE_STRUCT_FF_SOFT, FFI_TYPE_STRUCT_FD_SOFT,
FFI_TYPE_STRUCT_DF_SOFT, FFI_TYPE_STRUCT_SOFT): New defines.
(FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT): New ffi_abi enumerations.
(enum ffi_abi): Set FFI_DEFAULT_ABI for soft-float.
* src/mips/n32.S (ffi_call_N32): Add handling for soft-float
structure and pointer returns.
(ffi_closure_N32): Add handling for pointer returns.
* src/mips/ffi.c (ffi_prep_args, calc_n32_struct_flags,
calc_n32_return_struct_flags): Handle soft-float.
(ffi_prep_cif_machdep): Handle soft-float, fix pointer handling.
(ffi_call_N32): Declare proper argument types.
(ffi_call, copy_struct_N32, ffi_closure_mips_inner_N32): Handle
soft-float.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libffi.patch
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20090828/93041a50/attachment.ksh>
More information about the Java-patches
mailing list