Commit Graph

299 Commits

Author SHA1 Message Date
Jakub Jelinek 041f741770 libffi: Fix up x86_64 classify_argument
As the following testcase shows, libffi didn't handle properly
classify_arguments of structures at byte offsets not divisible by
UNITS_PER_WORD.  The following patch adjusts it to match what
config/i386/ classify_argument does for that and also ports the
PR38781 fix there (the second chunk).

This has been committed to upstream libffi already:
5651bea284

2021-06-16  Jakub Jelinek  <jakub@redhat.com>

	* src/x86/ffi64.c (classify_argument): For FFI_TYPE_STRUCT set words
	to number of words needed for type->size + byte_offset bytes rather
	than just type->size bytes.  Compute pos before the loop and check
	total size of the structure.
	* testsuite/libffi.call/nested_struct12.c: New test.
2021-06-16 10:45:27 +02:00
Alan Modra fff56af642 Re: [RS6000] Power10 libffi fixes
Adding a nop broke ffi_closure_LINUX64!

	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Correct
	location of .Lret.
2020-09-24 15:02:19 +09:30
Alan Modra 08cd8d5929 [RS6000] Power10 libffi fixes
Power10 pc-relative code doesn't use or preserve r2 as a TOC pointer.
That means calling between pc-relative and TOC using code can't be
done without intervening linker stubs, and a call from TOC code to
pc-relative code must have a nop after the bl in order to restore r2.

Now the PowerPC libffi assembly code doesn't use r2 except for the
implicit use when making calls back to C, ffi_closure_helper_LINUX64
and ffi_prep_args64.  So changing the assembly to interoperate with
pc-relative code without stubs is easily done.

	* src/powerpc/linux64.S (ffi_call_LINUX64): Don't emit global
	entry when __PCREL__.  Call using @notoc.  Add nops.
	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
	(ffi_go_closure_linux64): Likewise.
2020-09-24 12:44:08 +09:30
Andreas Schwab 68d235936b backport: ffi.c (ffi_call_go, [...]): New functions.
Backport of RISC-V support for libffi go closures
* src/riscv/ffi.c (ffi_call_go, ffi_prep_go_closure): New
functions.
(ffi_call_int): Renamed from ffi_call.
(ffi_call_asm, ffi_closure_inner): Adjust interface.
* src/riscv/ffitarget.h (FFI_GO_CLOSURES): Define.
* src/riscv/sysv.S (ffi_go_closure_asm): New function.
(ffi_closure_asm, ffi_call_asm): Update for adjusted interfaces.

From-SVN: r263550
2018-08-15 06:57:45 +00:00
Andreas Schwab 93249dde86 Backport of RISC-V support for libffi
* configure.host: Add RISC-V support.
* Makefile.am: Likewise.
* Makefile.in: Regenerate.
* src/riscv/ffi.c, src/riscv/ffitarget.h, src/riscv/sysv.S: New
files.

From-SVN: r260033
2018-05-08 10:29:16 +00:00
Alan Modra 71d372eba9 libffi PowerPC64 ELFv1 fp arg fixes
The ELFv1 ABI says: "Single precision floating point values are mapped
to the second word in a single doubleword" and also "Floating point
registers f1 through f13 are used consecutively to pass up to 13
floating point values, one member aggregates passed by value
containing a floating point value, and to pass complex floating point
values".

libffi wasn't expecting float args in the second word, and wasn't
passing one member aggregates in fp registers.  This patch fixes those
problems, making use of the existing ELFv2 homogeneous aggregate
support since a one element fp struct is a special case of an
homogeneous aggregate.

I've also set a flag when returning pointers that might be used one
day.  This is just a tidy since the ppc64 assembly support code
currently doesn't test FLAG_RETURNS_64BITS for integer types..

	* src/powerpc/ffi_linux64.c (discover_homogeneous_aggregate):
	Compile for ELFv1 too, handling single element aggregates.
	(ffi_prep_cif_linux64_core): Call discover_homogeneous_aggregate
	for ELFv1.  Set FLAG_RETURNS_64BITS for FFI_TYPE_POINTER return.
	(ffi_prep_args64): Call discover_homogeneous_aggregate for ELFv1,
	and handle single element structs containing float or double
	as if the element wasn't wrapped in a struct.  Store floats in
	second word of doubleword slot when big-endian.
	(ffi_closure_helper_LINUX64): Similarly.

From-SVN: r259934
2018-05-04 23:17:11 +09:30
Tony Reix fbdc37805a Import from libffi master repository.
2017-08-31  Tony Reix  <tony.reix@atos.net>

        * src/powerpc/aix.S (ffi_call_AIX): Add debugging pseudo-op and
        labels for EH.
        (ffi_call_go_AIX): New function.
        (_GLOBAL__F_libffi_src_powerpc_aix): New EH frame.
        * src/powerpc/aix_closure.S (ffi_closure_ASM): Add debugging
        pseudo-op and labels for EH.
        (ffi_go_closure_ASM): New function.
        (_GLOBAL__F_libffi_src_powerpc_aix_closure): New EH frame.
        * src/powrpc/ffi_darwin.c (ffi_call_go): New function.
        (ffi_prep_go_closure): New function.
        (ffi_closure_helper_common): Rename from ffi_closure_helper_DARWIN.
        (ffi_closure_helper_DARWIN): Call ffi_closure_helper_common.
        (ffi_go_closure_helper_DARWIN): Call ffi_closure_helper_common.
        * src/powerpc/ffitarget.h (FFI_GO_CLOSURES): Define.

From-SVN: r253386
2017-10-03 14:26:31 -04:00
John David Anglin 5961d13d27 ffi.c (ffi_struct_type): Put type declaration on separate line.
* src/pa/ffi.c (ffi_struct_type): Put type declaration on separate line.
	(ffi_prep_args_pa32): Likewise.
	(ffi_size_stack_pa32): Likewise.
	(ffi_prep_cif_machdep): Likewise.
	(ffi_call): Likewise.  Rename to ffi_call_int.  Add closure argument
	and update call to ffi_call_pa32.
	(ffi_call, ffi_call_go, ffi_prep_go_closure): New.
	(ffi_closure_inner_pa32): Update to handle go closures.
	* src/pa/ffitarget.h (FFI_GO_CLOSURES): Define.
	* src/pa/hpux32.S (ffi_call_pa32): Pass go closure argument in static
	chain register (%ret1).
	(ffi_closure_pa32): Set closure type argument to zero.
	(ffi_go_closure_pa32): New function.  Add unwind data for it.
	* src/pa/linux.S: Likewise.  Use cfi directives for unwind data.
	* testsuite/libffi.go/static-chain.h (STATIC_CHAIN_REG): Define for
	hppa.

From-SVN: r239978
2016-09-04 17:39:05 +00:00
Andreas Schwab a7ceba7d02 Summary: libffi: define FFI_SIZEOF_JAVA_RAW for aarch64 ILP32
* src/aarch64/ffitarget.h (FFI_SIZEOF_JAVA_RAW) [__ILP32__]:
Define.

From-SVN: r234282
2016-03-17 10:47:58 +00:00
Alan Modra c57173b69a [RS6000] Correct powerpc sysv stack argument accounting
ppc32 starts using the stack for integer arg passing when we run out
of integer arg passing registers.  Similarly, we start using the stack
for floating point args when we run out of floating point registers.
The decision on where an integer arg goes does not depend on number of
floating point args, nor does the decision on where a floating point
arg goes depend on number of integer args.  Alignment of stack args
also simply depends on number of stack args.

This patch untangles the horrible mess we had, with intarg_count being
wrongly used to count both integer args and stack words.

	* src/powerpc/ffi_sysv.c (ffi_prep_cif_sysv_core): Count fprs,
	gprs, and stack words separately.
	(ffi_prep_args_SYSV): Similarly.

From-SVN: r228307
2015-10-01 06:59:00 +09:30
Andrew Pinski 97c32df4ba ffitarget.h (ffi_arg): Use unsigned long long for ILP32.
2015-02-10  Andrew Pinski  <apinski@cavium.com>

        * src/aarch64/ffitarget.h (ffi_arg): Use unsigned long long for ILP32.
        (FFI_SIZEOF_ARG): Define to 64 for ILP32.
        (ffi_sarg): Use signed long long for ILP32.

        * src/aarch64/sysv.S (PTR_REG): New macro.
        (PTR_SIZE): New macro.
        (ffi_closure_SYSV): Load cif, fn and user_data using PTR_REG.
        (ffi_go_closure_SYSV): Load cif and fn using PTR_REG.

From-SVN: r220598
2015-02-10 14:46:47 -08:00
Richard Henderson ed4bf691b5 Merge with upstream libffi db1b34b7e1f5e473d17557e454a29933dfecd1af
Includes build fixes for Solaris and FreeBSD.

From-SVN: r220222
2015-01-28 15:23:55 -08:00
Richard Henderson 36035d7967 Merge with upstream libffi 3ac1610aa33c887ea9b14935208943925714a33e
Includes build fixes for Solaris and Cygwin.

From-SVN: r219860
2015-01-19 13:14:59 -08:00
Richard Henderson be723d1e73 re PR libffi/64572 (r219477 breaks bootstrap on x86_64 darwin)
PR libffi/64572

 * src/x86/ffitarget.h (FFI_GO_CLOSURES): Do not define for darwin.
 (FFI_TARGET_HAS_COMPLEX_TYPE): Likewise.

From-SVN: r219538
2015-01-13 07:29:47 -08:00
Richard Henderson ca46eab70b Fix libjava failures on i686-linux
* src/x86/ffi.c (ffi_raw_call): Fill in frame.

From-SVN: r219505
2015-01-12 16:26:31 -08:00
Richard Henderson b1760f7f91 Merge libffi to upstream commit c82cc159426d8d4402375fa1ae3f045b9cf82e16
From-SVN: r219477
2015-01-12 08:19:59 -08:00
Jakub Jelinek 1138382be4 linux64.S: Emit .note.GNU-stack even when POWERPC64 is not defined.
* 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.

From-SVN: r215155
2014-09-11 11:03:49 +02:00
Uros Bizjak f54860ea96 ffi.c: Do not include stdlib.h.
* src/alpha/ffi.c: Do not include stdlib.h.
	(ffi_closure_osf_inner) <default>: Use FFI_ASSERT instead of abort.

From-SVN: r213049
2014-07-25 11:01:45 +02:00
Bernd Edlinger 54fde020cc Enable Java on Cygwin-64
Currently it is not possible to build GCC's libjava support on Cygwin-64.

This patch fixes the current build-problems on Cygwin-64 and the most
fundamental bugs on that platform.

Note you must still add --enable-threads=posix to successfully build the
java language support.


boehm-gc/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix current cygwin-64 build problems.
        * include/gc_config_macros.h (GC_PTHREADS): Use __CYGWIN__ instead
        of __CYGWIN32__ here.
        * win32_threads.c (GC_push_all_stacks): Push all X86_64 registers.
        (GC_get_thread_stack_base): Get the stack base for X86_64.

libffi/ChangeLog:

2014-05-13  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.

libgcc/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * unwind-seh.c (_Unwind_Backtrace): Uncommented, finished
        implementation.

libjava/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix current cygwin-64 build problems.
        * configure.host: Added handling for x86_64-*-cygwin/mingw.
        * boehm.cc (_Jv_GCAttachThread, _Jv_GCDetachThread): Don't compile if
        GC_WIN32_THREADS is defined.
        * java/lang/natClass.cc (_Jv_InterfaceAssignableFrom): Rename interface
        to source_interface.

libjava/classpath/ChangeLog:

2014-05-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Fix current cygwin-64 build problems.
        * native/fdlibm/mprec.c (_REENT_CHECK_MP, _REENT_MP_FREELIST,
        _REENT_MP_P5S, __ULong, __Long): Undefine previous definitions.

From-SVN: r210386
2014-05-13 16:23:11 +00:00
Yufeng Zhang 5309143d87 sysv.S (ffi_closure_SYSV): Use x29 as the main CFA reg; update cfi_rel_offset.
libffi/

	* src/aarch64/sysv.S (ffi_closure_SYSV): Use x29 as the
	main CFA reg; update cfi_rel_offset.

From-SVN: r208515
2014-03-12 16:18:29 +00:00
Eric Botcazou 248d745ac2 re PR libffi/60073 (64-bit libffi.call/cls_double_va.c FAILs after recent modification)
PR libffi/60073
	* src/sparc/v8.S: Assemble only if !SPARC64.
	* src/sparc/v9.S: Remove obsolete comment.
	* src/sparc/ffitarget.h (enum ffi_abi): Add FFI_COMPAT_V9.
	(V8_ABI_P): New macro.
	(V9_ABI_P): Likewise.
	(FFI_EXTRA_CIF_FIELDS): Define only if SPARC64.
	* src/sparc/ffi.c (ffi_prep_args_v8): Compile only if !SPARC64.
	(ffi_prep_args_v9): Compile only if SPARC64.
	(ffi_prep_cif_machdep_core): Use V9_ABI_P predicate.
	(ffi_prep_cif_machdep): Guard access to nfixedargs field.
	(ffi_prep_cif_machdep_var): Likewise.
	(ffi_v9_layout_struct): Compile only if SPARC64.
	(ffi_call): Deal with FFI_V8PLUS and FFI_COMPAT_V9 and fix warnings.
	(ffi_prep_closure_loc): Use V9_ABI_P and V8_ABI_P predicates.
	(ffi_closure_sparc_inner_v8): Compile only if !SPARC64.
	(ffi_closure_sparc_inner_v9): Compile only if SPARC64.  Guard access
	to nfixedargs field.

From-SVN: r207822
2014-02-17 12:00:04 +00:00
Eric Botcazou 30255340f6 re PR libffi/60073 (64-bit libffi.call/cls_double_va.c FAILs after recent modification)
PR libffi/60073
	* src/sparc/ffitarget.h (FFI_TARGET_SPECIFIC_VARIADIC): Define.
	(FFI_EXTRA_CIF_FIELDS): Likewise.
	(FFI_NATIVE_RAW_API): Move around.
	* src/sparc/ffi.c (ffi_prep_cif_machdep_core): New function from...
	(ffi_prep_cif_machdep): ...here.  Call ffi_prep_cif_machdep_core.
	(ffi_prep_cif_machdep_var): New function.
	(ffi_closure_sparc_inner_v9): Do not pass anonymous FP arguments in
	FP registers.
	* doc/libffi.texi (Introduction): Fix inaccuracy.

From-SVN: r207763
2014-02-13 16:18:13 +00:00
Alan Modra e73d2479dd ffitarget.h: Import from upstream.
* src/powerpc/ffitarget.h: Import from upstream.
	* src/powerpc/ffi_powerpc.h: Likewise.
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/ffi_sysv.c: Likewise.
	* src/powerpc/ffi_linux64.c: Likewise.
	* src/powerpc/sysv.S: Likewise.
	* src/powerpc/ppc_closure.S: Likewise.
	* src/powerpc/linux64.S: Likewise.
	* src/powerpc/linux64_closure.S: Likewise.
	* src/types.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add new src/powerpc files.
	(nodist_libffi_la_SOURCES <POWERPC, POWERPC_FREEBSD>): Likewise.
	* configure.ac (HAVE_LONG_DOUBLE_VARIANT): Define for powerpc.
	* include/ffi.h.in (ffi_prep_types): Declare.
	* src/prep_cif.c (ffi_prep_cif_core): Call ffi_prep_types.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* Makefile.in: Regenerate.
	* man/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r205844
2013-12-10 11:12:14 +10:30
Alan Modra fd4da58cd8 ppc_closure.S: Don't bl .Luint128.
* src/powerpc/ppc_closure.S: Don't bl .Luint128.

From-SVN: r204918
2013-11-18 01:14:03 +10:30
Alan Modra 3521ba8b2e PowerPC64 ELFv2 support
PowerPC64 ELFv2 support
	* src/powerpc/ffitarget.h: Import from upstream.
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/linux64.S: Likewise.
	* src/powerpc/linux64_closure.S: Likewise.
	* doc/libffi.texi: Likewise.
	* testsuite/libffi.call/cls_double_va.c: Likewise.
	* testsuite/libffi.call/cls_longdouble_va.c: Likewise.

From-SVN: r204917
2013-11-18 01:05:08 +10:30
Alan Modra 40b45a6d76 ffi.c (ffi_prep_args_SYSV): Move var declaration before statements.
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Move var declaration
	before statements.
	(ffi_prep_args64): Support little-endian.
	(ffi_closure_helper_SYSV, ffi_closure_helper_LINUX64): Likewise.
	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
	* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.

From-SVN: r200383
2013-06-25 09:38:47 +09:30
Kai Tietz 8280eba03b win64.S: Make use of ffi_closure_win64_inner symbol pc-relative.
* src/x86/win64.S: Make use of ffi_closure_win64_inner
	symbol pc-relative.

From-SVN: r196900
2013-03-22 10:38:55 +01:00
Dave Korn bb78d7c4a2 closures.c (is_emutramp_enabled [!FFI_MMAP_EXEC_EMUTRAMP_PAX]): Move default definition outside enclosing #if scope.
* src/closures.c (is_emutramp_enabled [!FFI_MMAP_EXEC_EMUTRAMP_PAX]):
	Move default definition outside enclosing #if scope.

From-SVN: r196527
2013-03-07 22:25:20 +00:00
Andreas Tobler 8f093ea0b1 ffi.c (ffi_prep_cif_machdep): Fix case where DOUBLE equal LONGDOUBLE.
2013-02-06  Andreas Tobler  <andreast@fgznet.ch>

        * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix case where
        DOUBLE equal LONGDOUBLE.

From-SVN: r195812
2013-02-06 18:32:41 +01:00
Anthony Green b4b575ce78 libffi merge
From-SVN: r194722
2012-12-26 16:28:02 +00:00
Alan Modra 7054d980c1 linux64_closure.S: Add new ABI support.
* src/powerpc/linux64_closure.S: Add new ABI support.
	* src/powerpc/linux64.S: Likewise.

From-SVN: r193015
2012-10-31 14:15:34 +10:30
Andrew Pinski c5a3fffaab re PR libffi/53014 (libffi failures on mips64-linux-gnu with soft-float)
2012-08-26  Andrew Pinski  <apinski@cavium.com>

	PR libffi/53014
	* src/mips/ffi.c (ffi_prep_closure_loc): Allow n32 with soft-float and n64 with
	soft-float.

From-SVN: r190696
2012-08-26 11:29:21 -07:00
Uros Bizjak aa5d8db019 ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, just return FFI_BAD_ABI when things are wrong.
* src/s390/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
	just return FFI_BAD_ABI when things are wrong.

From-SVN: r190230
2012-08-08 16:48:43 +02:00
H.J. Lu d6a89122a6 Define FFI_SIZEOF_JAVA_RAW to 4 for x32
PR libffi/53982
	PR libffi/53973
	* src/x86/ffitarget.h: Check __ILP32__ instead of __LP64__ for
	x32.
	(FFI_SIZEOF_JAVA_RAW): Defined to 4 for x32.

From-SVN: r189626
2012-07-18 12:19:34 -07:00
Peter Bergner efe2a4b70e ffi.c (ffi_prep_args_SYSV): Declare double_tmp.
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp.
	Silence casting pointer to integer of different size warning.
	Delete goto to previously deleted label.
	(ffi_call): Silence possibly undefined warning.
	(ffi_closure_helper_SYSV): Declare variable type.

From-SVN: r186091
2012-04-02 13:29:22 -05:00
Anthony Green 6adb730866 Restore trampled commits
From-SVN: r185955
2012-03-29 12:41:52 +00:00
Kaz Kojima 60f9021b2a ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, just return FFI_BAD_ABI when things are wrong.
* src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
	just return FFI_BAD_ABI when things are wrong.
	* src/sh64/ffi.c (ffi_prep_closure_loc): Ditto.

From-SVN: r185361
2012-03-13 22:50:16 +00:00
David Edelsohn 935a74eea2 aix_closure.S (ffi_closure_ASM): Adjust for Darwin64 change to return value of ffi_closure_helper_DARWIN and...
* src/powerpc/aix_closure.S (ffi_closure_ASM): Adjust for Darwin64
        change to return value of ffi_closure_helper_DARWIN and load type
        from return type.

From-SVN: r185152
2012-03-09 14:51:54 -05:00
Anthony Green 34fa7690ac Merge upstream libffi
From-SVN: r184897
2012-03-04 21:11:09 +00:00
Kai Tietz ffc81ae2c8 re PR libffi/52221 ([libffi] r183675,r184021 needs to be fixed.)
PR libffi/52221
        * src/x86/ffi.c (ffi_closure_raw_THISCALL): New
        prototype.
        (ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
        thiscall-convention.
        (ffi_raw_call): Use ffi_prep_args_raw.
        * src/x86/win32.S (ffi_closure_raw_THISCALL): Add
        implementation for stub.

From-SVN: r184526
2012-02-23 22:02:27 +01:00
Kai Tietz d86c2d9495 re PR libffi/52221 ([libffi] r183675,r184021 needs to be fixed.)
PR libffi/52221
        * src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
        support for X86_WIN32.
        (FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.

From-SVN: r184155
2012-02-13 16:18:14 +01:00
Eric Botcazou a0dfc1fed5 * src/sparc/v9.S (STACKFRAME): Bump to 176.
From-SVN: r184129
2012-02-11 11:00:40 +00:00
Kai Tietz 893f430128 prep_cif.c (ffi_prep_cif): Allow for X86_WIN32 also FFI_THISCALL.
* src/prep_cif.c (ffi_prep_cif): Allow for X86_WIN32
        also FFI_THISCALL.
        * src/x86/ffi.c (ffi_closure_THISCALL): Add prototype.
        (FFI_INIT_TRAMPOLINE_THISCALL): New trampoline code.
        (ffi_prep_closure_loc): Add FFI_THISCALL support.
        * src/x86/ffitarget.h (FFI_TRAMPOLINE_SIZE): Adjust size.
        * src/x86/win32.S (ffi_closure_THISCALL): New closure code
        for thiscall-calling convention.
        * testsuite/libffi.call/closure_thiscall.c: New test.

From-SVN: r184021
2012-02-08 22:35:19 +01:00
Kai Tietz 9b850dd969 ffi.c (ffi_call_win32): Add new argument to prototype for specify calling-convention.
* src/libffi/src/x86/ffi.c (ffi_call_win32): Add new
        argument to prototype for specify calling-convention.
        (ffi_call): Add support for stdcall/thiscall convention.
        (ffi_prep_args): Likewise.
        (ffi_raw_call): Likewise.
        * src/x86/ffitarget.h (ffi_abi): Add FFI_THISCALL and
        FFI_FASTCALL.
        * src/x86/win32.S (_ffi_call_win32): Add support for
        fastcall/thiscall calling-convention calls.
        * testsuite/libffi.call/fastthis1_win32.c: New test.
        * testsuite/libffi.call/fastthis2_win32.c: New test.
        * testsuite/libffi.call/fastthis3_win32.c: New test.
        * testsuite/libffi.call/strlen2_win32.c: New test.
        * testsuite/libffi.call/many2_win32.c: New test.
        * testsuite/libffi.call/struct1_win32.c: New test.
        * testsuite/libffi.call/struct2_win32.c: New test.

From-SVN: r183676
2012-01-29 14:29:53 +01:00
Andreas Schwab c1d5e72390 sysv.S (ffi_call_SYSV): Properly test for plain mc68000.
* src/m68k/sysv.S (ffi_call_SYSV): Properly test for plain
mc68000.  Test for __HAVE_68881__ in addition to __MC68881__.

From-SVN: r183451
2012-01-23 20:00:44 +00:00
Jakub Jelinek 01ddefeba7 re PR target/48496 ('asm' operand requires impossible reload)
PR rtl-optimization/48496
	* src/ia64/ffi.c (ffi_call): Fix up aliasing violations.

From-SVN: r183301
2012-01-19 11:47:59 +01:00
Andrew Pinski 3b21983d06 n32.S: Add ".set mips4".
2011-12-07  Andrew Pinski  <apinski@cavium.com>

	* src/mips/n32.S: Add ".set mips4".

From-SVN: r182091
2011-12-07 14:58:31 -08:00
Iain Sandoe b90c2c4c0b re PR libffi/49594 (bootstrap failure in libffi:darwin_closure for powerpc-darwin8)
PR libffi/49594
	* src/powerpc/darwin_closure.S (stubs): Make the stub binding
	helper reference track the architecture pointer size.

From-SVN: r178512
2011-09-04 19:19:39 +00:00
Andrew Haley 4ac9cf2b5d ffi.c (FFI_INIT_TRAMPOLINE): Remove hard-coded assembly instructions.
2011-08-25  Andrew Haley  <aph@redhat.com>

        * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Remove hard-coded assembly
        instructions.
        * src/arm/sysv.S (ffi_arm_trampoline): Put them here instead.

From-SVN: r178060
2011-08-25 10:37:36 +00:00
Andrew Haley 4d4a9b72be ffi.c (FFI_INIT_TRAMPOLINE): Clear icache.
2011-07-11  Andrew Haley  <aph@redhat.com>

        * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache.

From-SVN: r176172
2011-07-11 17:50:04 +00:00