94 Commits
Author SHA1 Message Date
Richard Henderson 6e2e041b6d Merge pull request #297 from frida/fix/error-path
Fix error path so mutex is unlocked before returning
2017-03-14 19:37:45 -07:00
Richard Henderson 256ce51c40 Merge pull request #273 from wbx-github/master
m68k: support ISA-A Coldfire CPUs
2016-09-01 13:54:51 -07:00
Richard Henderson 2ded2a4f49 Merge pull request #272 from yousong/mips64-soft-float
Mips64 soft float
2016-09-01 13:30:45 -07:00
Richard Henderson 40e4063ab4 Merge pull request #261 from tromey/fix-260
Don't dereference "ecif" before NULL check
2016-07-07 23:11:38 -07:00
Richard Henderson c0829e6284 Merge pull request #259 from rth7680/master
Mark win64.S with GNU-stack note
2016-06-05 15:05:21 -07:00
Richard Henderson 794a54d4a6 Mark win64.S with GNU-stack note 2016-06-05 14:57:00 -07:00
Richard Henderson 96d9bf4b55 Merge pull request #253 from iains/darwin-build
Some Darwin build fixes
2016-06-03 23:04:56 -07:00
Richard Henderson 5d0365c605 Merge pull request #251 from berkerpeksag/delete-test-define
Remove unused FFI_CLOSURE_TEST
2016-05-19 09:35:38 -07:00
Richard Henderson c61775497e Merge pull request #247 from rth7680/symver
Add parent to symbol version LIBFFI_BASE_7.1
2016-05-18 11:10:33 -07:00
Richard Henderson 33d9a31d34 Add parent to symbol version LIBFFI_BASE_7.1 2016-05-18 11:01:55 -07:00
Richard Henderson 9edaa695c5 Merge pull request #230 from rth7680/symver
Use ELF symbol versioning
2016-05-18 10:56:19 -07:00
Richard Henderson 8a0a4e25ef Update symbol versioning for ffi_get_struct_offsets
Given that the original symbol versioning patch has shipped
with gcc-6, it would be kind to keep that as a valid base ABI
and make subsequent changes to version 7.1.
2016-05-04 07:33:41 -10:00
Richard Henderson c02c341444 Use ELF symbol versioning
At the same time, we must bump the (major) ABI version.  This needed to be
done anyway due to ABI breakage in the AArch64 port (see 12cf89ee and the
corresponding GCC PR70024).
2016-05-04 06:49:50 -10:00
Richard Henderson 14be9a1d07 Merge pull request #245 from rth7680/tromey-ffi-prep-cif-core-is-private
A rebase of #219
2016-05-04 06:45:05 -10:00
Richard Henderson 48bfae1f37 Merge pull request #236 from andreas-schwab/master
Define FFI_SIZEOF_JAVA_RAW for aarch64 ILP32
2016-05-02 20:58:57 -10:00
Richard Henderson 6d8711057b Merge pull request #241 from rth7680/fix-win64
Fix win64 abi calling from unix64
2016-05-01 11:02:40 -10:00
Richard Henderson e5843a3a09 x86: Fix calling convention for ffi_closure_win64_inner
Also enable testing for the cross-abi calls.
2016-04-29 14:17:36 -07:00
Richard Henderson d06751979b x86: Copy fix for clang .org from unix64.S
Clang doesn't understand .org with symbolic operands.
2016-04-15 16:10:28 -07:00
Richard Henderson 4cdedc279f Tidy call.exp test collection
Commit c952a92e20 moved all of
the complex tests to libffi.complex, but failed to remove the
anti-globbing from libffi.call.
2015-10-20 07:16:10 -10:00
Richard Henderson 609db2fbe4 Test case from Issue #70 2015-10-20 07:16:10 -10:00
Richard Henderson 2104b2a4fc sparc: Re-introduce hand-written unwind info
Fixes the build with the Solaris assembler.
2015-01-28 09:41:07 -08:00
Richard Henderson b0e9796344 configure: Run HAVE_AS_X86_PCREL for all X86 targets 2015-01-27 22:10:12 -08:00
Richard Henderson 3ac1610aa3 x86: Fix cygwin32 build
The section syntax is just that little bit different.
2015-01-19 20:48:40 +01:00
Richard Henderson 1ad0b17177 sparc: Also mark the return address in unwind info 2015-01-16 13:30:05 -08:00
Richard Henderson d68c8aed19 sparc: Solaris fixes, part 2
/bin/as seems to only understand single-digit labels
/bin/as knows nothing about .rept/.endr
2015-01-16 11:40:33 -08:00
Richard Henderson e46842b414 Remove extra brackets in configure.host
This table is no longer in configure.ac, needing
protection from m4.
2015-01-13 07:23:48 -08:00
Richard Henderson f27c4e4673 x86: Fix thinko in ffi_raw_call
Missed structure initialization for raw path.
Apparently there are no tests for this outside gcc.
2015-01-13 07:22:07 -08:00
Richard Henderson 3fa5d70cbb x86: Avoid fastcall when building with pcc
Apparently, PCC doesn't support the fastcall calling convention.
Nor does it issue a warning or error for the attribute that it
does not understand.
2015-01-05 13:03:06 -08:00
Richard Henderson a03d2310ed x86: Load structure return address into eax 2015-01-05 12:24:51 -08:00
Richard Henderson b7f6d7aa9b x86: Reinstate hand-written unwind info for sysv.S 2015-01-05 10:01:38 -08:00
Richard Henderson 6cedf81ca7 x86: Expand FFI_GO_CLOSURE
If we're going to have to hand-write unwind info for darwin,
these macros make the job harder.
2015-01-05 10:01:38 -08:00
Richard Henderson 8fa3c9f24b x86: Reinstate hand-written unwind info for unix64.S
One more try to get default Darwin to work.
2015-01-05 10:01:37 -08:00
Richard Henderson 5f35e0ffcc x86: Avoid using gas local labels
Which are unsupported by Darwin cctools as.
Thankfully this doesn't uglify the source too much.
2015-01-05 10:01:37 -08:00
Richard Henderson ed1ca2777c x86: Remove use of .cfi_escape
The unwind info isn't 100% correct at all points during the epilogue,
and not annotating is just as incorrect as the annotation.  This works
better on systems that do not support DW_OP_call_frame_cfa.
2015-01-05 10:01:37 -08:00
Richard Henderson 1b12593d7e x86: Honor alignment of arguments
Darwin aligns long-double to 16, and thus all of the long double
tests were failing due to not honoring that.  We ought to be able
to devise a test case for GCC using __attribute__((aligned)) that
would have failed too.
2015-01-05 10:01:37 -08:00
Richard Henderson 042b8dafee x86: Use .balign not .align
The Apple assembler defaults to power of two alignment, rather than
byte alignment like everyone else.  Force byte alignment by using
the proper directive.
2015-01-05 10:01:37 -08:00
Richard Henderson 0172bc029c x86: Disable .org for Darwin 2015-01-05 10:01:37 -08:00
Richard Henderson 9f112619c1 x86: Best guess at update for Darwin 2015-01-05 10:01:37 -08:00
Richard Henderson 2f65246968 x86: Handle void arguments as if an empty structure
Since libffi currently doesn't allow empty structures, libgo
currently maps them to ffi_type_void.  Given that we'll abort
on this case, handle it gracefully.
2014-12-11 14:16:00 -08:00
Richard Henderson 097ccfd6a6 x86: Fix some unwind errors 2014-12-11 14:11:44 -08:00
Richard Henderson 590663b30b powerpc: Fix ffi_go_closure_linux64
Unlike ffi_closure_LINUX64, this entry point is called normally,
so we already have the TOC in R2 and the closure in R11.

	* powerpc/linux64_closure.S (ffi_closure_LINUX64): Remove a
	register dependency chain.
	(ffi_go_closure_linux64): Don't load r11 or r2.
2014-11-20 11:35:12 +10:30
Richard Henderson 542e004710 sparc: Define FFI_TARGET_SPECIFIC_VARIADIC for v9
This is a port of

  http://gcc.gnu.org/viewcvs?rev=207763&root=gcc&view=rev

aka GCC PR libffi/60073, to the rewritten Sparc codebase.
Supposedly, we should have seen failures with the existing
libffi.call/cls_double_va.c testcase, but I hadn't.
Perhaps a gcc newer than 4.6.3 is required to see that...
2014-11-18 05:07:00 -08:00
Richard Henderson ccdd7bb856 testsuite: Fix alpha static chain register name 2014-11-16 12:12:23 +01:00
Richard Henderson dea49e2020 x86: Fix typo in ffi_prep_go_closure
Used the wrong register for THISCALL and FASTCALL.
2014-11-14 13:07:47 +01:00
Richard Henderson c9f5b6648b testsuite: Add trivial tests for Go closures 2014-11-14 13:07:47 +01:00
Richard Henderson c952a92e20 testsuite: Move complex tests to their own subdirectory
It seems a bit silly to isolate them by globbing vs "*complex*"
when we can just as easily put them in their own subdirectory.
2014-11-14 13:07:47 +01:00
Richard Henderson f1301a54bb testsuite: Use feature test rather than enumeration for complex 2014-11-14 13:07:45 +01:00
Richard Henderson b5ade2fb5d testsuite: Detect clang
Clang doesn't like the -Wno-psabi argument that we want to pass to GCC.
Since clang is detected as GCC via __GNUC__, use ax_cv_c_compiler_vendor.
2014-11-14 13:07:16 +01:00
Richard Henderson 5d69d57a05 configure: Move target source selection into configure.host
This eliminates the AM_CONDITIONAL ugliness, which eliminates
just a bit of extra boilerplate for a new target.

At the same time, properly categorize the EXTRA_DIST files
into SOURCES and HEADERS, for the generation of ctags.
2014-11-14 13:06:12 +01:00
Richard Henderson 57f5248457 configure: Split out configure.host
Split out the host case statement to a separate file, so that
we don't have to regenerate configure.in for changes therein.
2014-11-13 12:42:54 +01:00
Richard Henderson f8632815a6 powerpc: Delete patch output
Clearly added by mistake.
2014-11-13 12:32:35 +01:00
Richard Henderson 56735e05fe Merge branch 'go-closure' of https://github.com/rth7680/libffi into rth7680-go-closure
Conflicts:
	src/aarch64/ffi.c
2014-11-12 07:51:12 -05:00
Richard Henderson 0e303c0657 x86: Work around clang bugs
http://llvm.org/bugs/show_bug.cgi?21500
http://llvm.org/bugs/show_bug.cgi?21501
http://llvm.org/bugs/show_bug.cgi?21515
2014-11-12 03:58:58 -08:00
Richard Henderson 6eec410f15 sparc: Re-add abi compliant structure support
The original code, removed in the "rewrite" patch, was incorrect for
large structures, and required dynamic allocation of a trampoline on
every ffi_call.

Instead, allocate a 4k entry table of all possible structure returns.
The table is 80k, but is read-only and dynamically paged, which ought
to be better than allocating the trampoline.

This is difficult to test with gcc.  One can only use -O0 at present.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63668.
2014-11-12 09:36:11 +01:00
Richard Henderson 92022496ef sparc: Add support for Go closures 2014-11-12 09:36:11 +01:00
Richard Henderson ad89c2d9e9 sparc: Add support for complex types 2014-11-12 09:36:09 +01:00
Richard Henderson 20da5b4132 sparc: Handle more cases of structure return directly 2014-11-12 09:35:24 +01:00
Richard Henderson 0686c2e71c sparc: Preprocess float point struct return
We can eliminate recursion and speed structure return
by flattening a nested structure tree into a bitmask.
2014-11-12 09:35:24 +01:00
Richard Henderson 2b27890ba7 sparc: Rewrite everything
It's impossible to call between v8 and v9 ABIs, because of the stack bias
in the v9 ABI.  So let's not pretend it's just not implemented yet.  Split
the v9 code out to a separate file.

The register windows prevent ffi_call from setting up the entire stack
frame the assembly, but we needn't make an indirect call back to prep_args.
2014-11-12 09:35:21 +01:00
Richard Henderson 5d7b544505 sparc: Tidy up symbols
Assembly to use local labels, .type annotation, hidden annotation.
I do retain the _prefix for the symbols, but given that it wasn't
done consistently across all symbols, I doubt it's actually needed.
2014-11-12 09:34:24 +01:00
Richard Henderson fd4f7cc0ca sparc: Eliminate long double ifdefs 2014-11-12 09:34:24 +01:00
Richard Henderson ab83cbb90b arm: Add support for Go closures 2014-11-12 09:32:39 +01:00
Richard Henderson 6fa617dabc arm: Add argument space for the hidden struct return pointer
This should have been failing all along, but it's only
exposed by the complex_int test case.
2014-11-12 09:32:39 +01:00
Richard Henderson a529bec27b arm: Add support for complex types 2014-11-12 09:32:36 +01:00
Richard Henderson 5e88ebe627 arm: Remove internal FFI_TYPE constants
These have been replaced by the contents of internal.h.
2014-11-12 09:32:13 +01:00
Richard Henderson a4b785ea69 arm: Rewrite ffi_closure
Move the push of the argument registers into ffi_closure_SYSV,
reducing the size of the trampoline.
2014-11-12 09:32:13 +01:00
Richard Henderson e7f15f60e8 arm: Rewrite ffi_call
Use the trick to allocate the stack frame for ffi_call_SYSV
within ffi_call itself.
2014-11-12 09:32:13 +01:00
Richard Henderson a74a3aaddb arm: Rewrite vfp_type_p
Do not modify the ffi_type.  Rearrange the tests so that we
quickly eliminate structures that cannot match.  Return an
encoded value of element count and base type.
2014-11-12 09:32:13 +01:00
Richard Henderson 0d39b4bb69 arm: Deref ffi_put_arg arguments 2014-11-12 09:32:13 +01:00
Richard Henderson 57b24fb3f5 arm: Deref ffi_align argument 2014-11-12 09:32:13 +01:00
Richard Henderson c129bea82a arm: Reindent arm/ffi.c 2014-11-12 09:32:13 +01:00
Richard Henderson 9761b7bb70 alpha: Add support for Go closures 2014-11-12 09:31:21 +01:00
Richard Henderson f41bec3b57 alpha: Add support for complex types 2014-11-12 09:31:19 +01:00
Richard Henderson 5f917371af alpha: Clean up conversion of float values
Don't use "real" conversion to double, lest we raise
exceptions when passing signalling nans.
2014-11-12 09:30:59 +01:00
Richard Henderson 32a26b75ba alpha: Reorganize cif flags
Unties the backend from changes to FFI_TYPE_* constants, and allows
compilation to succeed after the addition of FFI_TYPE_COMPLEX.

Delete the hand-written unwind info.
2014-11-12 09:30:59 +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