Commit Graph
766 Commits
Author SHA1 Message Date
Richard Henderson 18b74ce54a aarch64: Fix non-apple compilation 2014-11-12 09:28:44 +01:00
Richard Henderson 2650f47fe8 x86: Use win32 name mangling for fastcall functions 2014-11-12 09:16:02 +01:00
Richard Henderson f8c64e2486 x86: Add support for Go closures 2014-11-12 09:16:02 +01:00
Richard Henderson 198f469e91 x86: Add support for Complex 2014-11-12 09:16:02 +01:00
Richard Henderson b21ec1ce78 x86: Rewrite closures
Move everything into sysv.S, removing win32.S and freebsd.S.
Handle all abis with a single ffi_closure_inner function.
Move complexity of the raw THISCALL trampoline into assembly
instead of the trampoline itself.
Only push the context for the REGISTER abi; let the rest
receive it in a register.
2014-11-12 09:15:54 +01:00
Richard Henderson b9ac94f3af x86: Rewrite ffi_call
Decouple the assembly from FFI_TYPE_*.  Merge prep_args with ffi_call,
passing the frame and the stack to the assembly.

Note that this patch isn't really standalone, as this breaks closures.
2014-11-12 09:15:35 +01:00
Richard Henderson 159d3788eb x86: Convert to gas generated unwind info 2014-11-12 09:15:35 +01:00
Richard Henderson e7b0056d60 x86: Force FFI_TYPE_LONGDOUBLE different from FFI_TYPE_DOUBLE
There are few abis that set double = long double.  Eliminate the
conditional compilation and let this code simply be unused there.
2014-11-12 09:15:35 +01:00
Richard Henderson 4b2fad8fd5 x86: Remove some conditional compilation
Removal of ifdefs made possible to due to ffi_abi unification.
2014-11-12 09:15:35 +01:00
Richard Henderson ef76205647 x86: Tidy ffi_abi
The x86_64 unix port only handles one ABI; don't define all of the
other symbols.  The UNIX64 symbol retains the same value.

The i386 ports ought to have the same symbols, even if we can't yet
unify the values without incrementing the libffi soname.
2014-11-12 09:15:35 +01:00
Richard Henderson 7cf841324f testsuite: Add two dg-do run markers
Caught by clang warning about unused -L parameter.
2014-11-12 09:15:35 +01:00
Richard Henderson fc501750f4 testsuite: Fix return_complex2 vs excessive precision
Use the previously computed rc2 to validate, rather than
recomputing a floating point result with excess precision.
2014-11-12 09:15:35 +01:00
Richard Henderson 610c90bf71 x86_64: Add support for complex types 2014-11-12 09:15:35 +01:00
Richard Henderson 32c5683163 x86_64: Decouple return types from FFI_TYPE constants
We can better support structure returns, and as prep for
complex types.
2014-11-12 09:15:35 +01:00
Richard Henderson 2e9dc16556 x86_64: Fixups for x32 2014-11-12 09:15:35 +01:00
Richard Henderson ebd82769de win64: Remove support from ffi.c 2014-11-12 09:15:35 +01:00
Richard Henderson 99db4d42ac win64: Rewrite
It's way too different from the 32-bit ABIs with which it is
currently associated. As seen from all of the existing XFAILs.
2014-11-12 09:15:35 +01:00
Richard Henderson 6b62fb4a26 x86-64: Support go closures
Dumps all of the hand-coded unwind info for gas generated.  Move jump
table data into .rodata.  Adjust ffi_call_unix64 to load the static
chain.  Split out sse portions of ffi_closure_unix64 to
ffi_closure_unix64_sse rather than test cif->flags at runtime.
2014-11-12 09:15:35 +01:00
Richard Henderson 89bbde8b4e Add ffi_cfi.h
Have one copy of the HAVE_AS_CFI_PSEUDO_OP code
to share between all backends.
2014-11-12 09:15:35 +01:00
Richard Henderson e951d64c08 Add entry points for interacting with Go
A "ffi_go_closure" is intended to be compatible with the
function descriptors used by Go, and ffi_call_go sets up
the static chain parameter for calling a Go function.

The entry points are disabled when a backend has not been
updated, much like we do for "normal" closures.
2014-11-12 09:15:35 +01:00
Anthony Green a0bdc5250c Fix typo 2014-11-11 09:43:01 -05:00
Anthony Green 67c0c07053 Final 3.2 changes 2014-11-11 07:30:49 -05:00
Anthony Green ee826b933b Final 3.2 changes 2014-11-11 07:29:26 -05:00
Anthony Green c81a705d53 Mention OpenRISC 2014-11-04 13:29:58 -05:00
Anthony Green 6a17ad540d Merge pull request #134 from s-macke/openrisc
Add OpenRISC support
2014-09-28 00:54:00 -04:00
Anthony Green 990eb9d4c2 Only run the complex type tests on supported platforms. 2014-09-28 00:50:29 -04:00
Sebastian Macke 0f316ab7c1 Add OpenRISC support
This patch adds support for the OpenRISC architecture.
(http://opencores.org/or1k/Main_Page)

This patch has been tested under Linux with QEMU-user emulation support.
- 32 Bit
- big endian
- delayed instructions
This is the only available configuration under Linux.

The description of the ABI can be found on the official website.

Is passes the testsuite except of the unwindtest_ffi_call.cc
testcase, which seems to be a problem of gcc and not libffi.
Some testcases of the gcc testsuite still fail.

Signed-off-by: Sebastian Macke <sebastian@macke.de>
2014-09-27 00:56:56 +00:00
Anthony Green 6695983d2f Add complex type support. Mostly broken right now 2014-09-20 07:44:37 -04:00
Anthony Green fbbf48fbdf Compile tests with -Wno-psabi when using GCC 2014-09-20 07:43:51 -04:00
Anthony Green ae8d2554c5 Update version to 3.2 2014-09-20 07:08:37 -04:00
Anthony Green b2ca59d39d More README updates for 3.2 2014-09-20 07:08:05 -04:00
Anthony Green f920a01ad8 Update release notes. 2014-09-20 06:54:06 -04:00
Bernd Edlinger bfcbf329c5 2014-05-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
Fix current cygwin-64 build problems.
	* src/java_raw_api.c: Remove if !defined(FFI_NO_RAW_API).
	* src/x86/ffi.c: Add if defined(__CYGWIN__).
	* src/x86/win64.S (ffi_closure_win64, ffi_call_win64): Added
	handling for FFI_TYPE_UINT64, FFI_TYPE_POINTER and FFI_TYPE_INT.
	Added SEH information.  Fixed formatting.
2014-09-20 06:51:45 -04:00
Jakub Jelinek 32cb2ce81d 2014-09-10 Jakub Jelinek <jakub@redhat.com>
* src/powerpc/linux64.S: Emit .note.GNU-stack even when
	POWERPC64 is not defined.
	* src/powerpc/linux64_closure.S: Likewise.  Also test _CALL_ELF == 2.
2014-09-20 06:39:55 -04:00
Matthias Klose aaf3101ba8 Fix -Werror=declaration-after-statement problem 2014-09-20 06:37:04 -04:00
Dominik Vogt 6e8a446083 2014-07-22 Dominik Vogt <vogt@linux.vnet.ibm.com>
* src/types.c (FFI_TYPEDEF, FFI_NONCONST_TYPEDEF): Merge the macros by
	adding another argument that controls whether the result is const or not
	(FFI_LDBL_CONST): Temporary macro to reduce ifdef confusion
	* src/prep_cif.c (ffi_prep_cif_core): Replace list of systems with new
	macro FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
	* src/pa/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
	Define.
	* src/s390/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
	Define.
	* src/x86/ffitarget.h (FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION):
	Define.

2014-07-22  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* doc/libffi.texi (Primitive Types): Document ffi_type_complex_float,
	ffi_type_complex_double and ffi_type_complex_longdouble
	(Complex Types): New subsection.
	(Complex Type Example): Ditto.
	* testsuite/libffi.call/cls_align_complex_double.c: New
	FFI_TYPE_COMPLEX test.
	* testsuite/libffi.call/cls_align_complex_float.c: Ditto.
	* testsuite/libffi.call/cls_align_complex_longdouble.c: Ditto.
	* testsuite/libffi.call/cls_complex_double.c: Ditto.
	* testsuite/libffi.call/cls_complex_float.c: Ditto.
	* testsuite/libffi.call/cls_complex_longdouble.c: Ditto.
	* testsuite/libffi.call/cls_complex_struct_double.c: Ditto.
	* testsuite/libffi.call/cls_complex_struct_float.c: Ditto.
	* testsuite/libffi.call/cls_complex_struct_longdouble.c: Ditto.
	* testsuite/libffi.call/cls_complex_va_double.c: Ditto.
	* testsuite/libffi.call/cls_complex_va_float.c: Ditto.
	* testsuite/libffi.call/cls_complex_va_longdouble.c: Ditto.
	* testsuite/libffi.call/complex_double.c: Ditto.
	* testsuite/libffi.call/complex_defs_double.c: Ditto.
	* testsuite/libffi.call/complex_float.c: Ditto.
	* testsuite/libffi.call/complex_defs_float.c: Ditto.
	* testsuite/libffi.call/complex_longdouble.c: Ditto.
	* testsuite/libffi.call/complex_defs_longdouble.c: Ditto.
	* testsuite/libffi.call/complex_int.c: Ditto.
	* testsuite/libffi.call/many_complex_double.c: Ditto.
	* testsuite/libffi.call/many_complex_float.c: Ditto.
	* testsuite/libffi.call/many_complex_longdouble.c: Ditto.
	* testsuite/libffi.call/return_complex1_double.c: Ditto.
	* testsuite/libffi.call/return_complex1_float.c: Ditto.
	* testsuite/libffi.call/return_complex1_longdouble.c: Ditto.
	* testsuite/libffi.call/return_complex2_double.c: Ditto.
	* testsuite/libffi.call/return_complex2_float.c: Ditto.
	* testsuite/libffi.call/return_complex2_longdouble.c: Ditto.
	* testsuite/libffi.call/return_complex_double.c: Ditto.
	* testsuite/libffi.call/return_complex_float.c: Ditto.
	* testsuite/libffi.call/return_complex_longdouble.c: Ditto.
	* src/raw_api.c (ffi_raw_to_ptrarray): Handle FFI_TYPE_COMPLEX
	(ffi_ptrarray_to_raw): Ditto.
	* src/prep_cif.c (ffi_prep_cif_core): Abort if FFI_TYPE_COMPLEX is not
	implemented in libffi for the target.
	* src/java_raw_api.c (ffi_java_raw_size): FFI_TYPE_COMPLEX not supported
	yet (abort).
	(ffi_java_raw_to_ptrarray): Ditto.
	(ffi_java_rvalue_to_raw): Ditto.
	(ffi_java_raw_to_rvalue):  Ditto.
	* src/debug.c (ffi_type_test): Add debug tests for complex types.
	* include/ffi.h.in (FFI_TYPE_COMPLEX): Add new FFI_TYPE_COMPLEX.
	(FFI_TYPE_LAST): Bump.
	(ffi_type_complex_float): Add new ffi_type_....
	(ffi_type_complex_double): Ditto.
	(ffi_type_complex_longdouble): Ditto.

2014-07-22  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* src/s390/ffitarget.h (FFI_TARGET_HAS_COMPLEX_TYPE): Define to provide
	FFI_TYPE_COMPLEX support.
	* src/s390/ffi.c (ffi_check_struct_type): Implement FFI_TYPE_COMPLEX
	(ffi_prep_args): Ditto.
	(ffi_prep_cif_machdep): Ditto.
	(ffi_closure_helper_SYSV): Ditto.
2014-09-20 06:24:41 -04:00
Anthony Green 4c5c4088aa Merge pull request #132 from nielsAD/master
Pascal and Register calling convention support on x86
2014-09-18 19:10:54 -04:00
Anthony Green 862f53de04 Merge pull request #130 from frida/fix/darwin-aarch64-float-alignment
Fix alignment of FFI_TYPE_FLOAT for Apple's ARM64 ABI
2014-09-18 19:06:08 -04:00
Anthony Green 5df384077f Merge pull request #129 from frida/fix/darwin-aarch64-cif-prep
Fix non-variadic CIF initialization for Apple/ARM64
2014-09-18 19:05:35 -04:00
Anthony Green 7b7a5284de Merge pull request #124 from knuesel/master
Fix issue with builddir when calling configure with absolute path
2014-09-18 18:28:05 -04:00
Anthony Green 4cd5e84012 Merge pull request #123 from ehsan/clang-cl
Add support for building with clang-cl
2014-09-18 18:27:15 -04:00
nielsAD 5d6340ef2c Determine whether register arguments (THISCALL/FASTCALL/REGISTER) are really passed via register to closures. Use stack if not. 2014-08-25 17:42:07 +02:00
nielsAD 6e346487b8 Fixed THISCALL/FASTCALL closures and added basic support for PASCAL/REGISTER closures. 2014-08-25 12:23:29 +02:00
nielsAD 098dca6b31 Support for calling functions with PASCAL and REGISTER calling conventions on x86 Windows/Linux.
Also changed indentation to be more consistent throughout the (adjusted) files.
2014-08-24 14:29:38 +02:00
Ehsan Akhgari 08853e32fb Enable forcing the usage of the static CRT in libffi's msvc wrapper
This is required for AddressSanitizer builds with clang-cl.
2014-07-31 20:35:49 -04:00
Ole André Vadla Ravnås aebf2c3023 Fix alignment of FFI_TYPE_FLOAT for Apple's ARM64 ABI 2014-07-26 00:17:47 +02:00
Ole André Vadla Ravnås 0f4e09d27d Fix non-variadic CIF initialization for Apple/ARM64
Turns out `aarch64_nfixedargs` wasn't initialized in the non-variadic
case, resulting in undefined behavior when allocating arguments.
2014-07-26 00:17:07 +02:00
Jeremie Knuesel 6172a995e1 Fix issue with builddir when calling configure with absolute path 2014-06-25 12:36:20 +02:00
Ehsan Akhgari fb25cd08ed Add support for building with clang-cl 2014-06-12 20:42:18 -04:00
Anthony Green 1cee07be47 Remove compiler warning 2014-06-12 06:30:59 -04:00