Commit Graph
463 Commits
Author SHA1 Message Date
Josh Triplett b5fed60194 Fix ABI on 32-bit non-Windows x86: go back to trampoline size 10
The trampoline size is part of the ABI, so it cannot change.  Move the
logic from the stdcall and thiscall trampolines to the functions they
call, to reduce them both to 10 bytes.

This drops the previously added support for raw THISCALL closures on
non-Windows.  (Non-raw THISCALL closures still work.)
2014-04-05 17:33:42 -07:00
Anthony Green afee53738a Merge pull request #106 from joshtriplett/darwin-award
[3.1 blocker] Update OS X build system to include win32.S on 32-bit
2014-03-25 16:12:35 -04:00
Anthony Green 7d2478568e Merge pull request #110 from joshtriplett/w64
Fix 64-bit Windows support
2014-03-25 16:12:17 -04:00
Josh Triplett be50b87a49 Always use configure to detect whether global symbols need underscores
64-bit Windows already used this check; make it universal, and use it in
place of an ifdef on X86_WIN32, to handle non-Windows platforms that use
the underscore, such as Darwin.
2014-03-24 21:45:47 -07:00
Josh Triplett 56be47f876 Fix a warning on 64-bit Windows
When sizeof(size_t) != sizeof(unsigned), adding a size_t to cif->bytes
produces a "possible loss of data" warning.  However, the size_t in
question refers to the size of a single parameter.  Use a cast to avoid
the warning.
2014-03-24 21:24:53 -07:00
Josh Triplett 48a8eda74a Avoid referencing undefined ABIs on 64-bit Windows builds
64-bit Windows does not have FFI_STDCALL, FFI_THISCALL, or FFI_FASTCALL.
2014-03-24 21:21:12 -07:00
Josh Triplett f0f4138f90 win32.S: Add handling for position-independent code on Darwin
Newer versions of Darwin generate the necessary stub functions
automatically and just need a call instruction, but accomodating older
versions as well requires adding the stub.
2014-03-22 10:04:11 -07:00
Josh Triplett ef5890ebaf win32.S: Use shifting for multiplication rather than repeated addition
The jump table code added a register to itself twice to multiply by 4;
shift the register left by 2 instead.
2014-03-21 11:02:50 -07:00
Josh Triplett 4fca48901e win32.S: Make the jump tables position-independent
Now that non-Windows platforms include win32.S, it needs to support
building as position-independent code.  This fixes build failures on
target platforms that do not allow text relocations.
2014-03-21 11:00:41 -07:00
Josh Triplett 2087dcf736 win32.S: Make calls to ffi_closure_SYSV_inner position-independent
Now that non-Windows platforms include win32.S, it needs to support
building as position-independent code.  This fixes one source of build
failures on target platforms that do not allow text relocations.
2014-03-21 10:57:06 -07:00
Josh Triplett e1911f78df Add support for stdcall, thiscall, and fastcall on non-Windows x86-32
Linux supports the stdcall calling convention, either via functions
explicitly declared with the stdcall attribute, or via code compiled
with -mrtd which effectively makes stdcall the default.

This introduces FFI_STDCALL, FFI_THISCALL, and FFI_FASTCALL on
non-Windows x86-32 platforms, as non-default calling conventions.
2014-03-16 05:05:06 -07:00
Josh Triplett 9531d05f64 prep_cif.c: Remove unnecessary ifdef for X86_WIN32
ffi_prep_cif_core had a special case for X86_WIN32, checking for
FFI_THISCALL in addition to the FFI_FIRST_ABI-to-FFI_LAST_ABI range
before returning FFI_BAD_ABI.  However, on X86_WIN32, FFI_THISCALL
already falls in that range, making the special case unnecessary.
Remove it.
2014-03-16 04:56:57 -07:00
Anthony Green 11d7aa9d7a Merge pull request #46 from makotokato/android-clang
Fix build failure when using clang for Android
2014-02-28 01:09:06 -05:00
Anthony Green 20698abc6a Merge pull request #66 from ppizarro/master
BlackFin fixes - Fatal error when calling a function defined in a shared library from within the function called by FFI
2014-02-28 00:58:30 -05:00
Anthony Green edf29c5169 Merge pull request #75 from joshtriplett/longdouble
Fix build error on x86 without distinct long double
2014-02-28 00:50:25 -05:00
Anthony Green 001aaf4b1b When no VFP arguments are present the IP register is used
uninitialized. Initialize it to the value of FP.

This fixes a number of testsuite failures when configured for
armv7l-unknown-linux-gnueabihf
2014-02-28 00:20:17 -05:00
Anthony Green 49f7729c3c aarch64 fix 2014-02-28 00:17:16 -05:00
Anthony Green 447483d51c Fix ChangeLog merge 2014-02-27 15:42:41 -05:00
Josh Triplett 3998d2604b Fix build error on x86 without distinct long double
src/x86/ffi64.c: In function 'classify_argument':
src/x86/ffi64.c:205:5: error: duplicate case value
     case FFI_TYPE_LONGDOUBLE:
     ^
src/x86/ffi64.c:202:5: error: previously used here
     case FFI_TYPE_DOUBLE:
     ^
2014-02-17 11:20:33 -08:00
Anthony Green 51377bda9a Merge pull request #72 from heiher/devel
MIPS N32: Fix call floating point va function
2014-02-15 08:06:29 -05:00
Heiher 40927bd3e1 Fix call floating point va function
I'm not sure floating-point arguments in GPR or FPR before calling
variable number arguments function. so, load all arguments to GPR and
FPR.
2014-02-09 10:38:24 +08:00
Zachary Waldowski b4df9cf9cc AArch64: Fix void fall-through case when assertions are enabled 2014-02-05 14:29:08 -05:00
Zachary Waldowski f466aad0d9 AArch64: Fix missing semicolons when assertions are enabled 2014-02-05 14:28:59 -05:00
Zachary Waldowski 0a0f12ce1f AArch64: Remove duplicitous element_count call.
This inhibits an analyzer warning by Clang.
2014-02-05 14:28:59 -05:00
Zachary Waldowski 4330fdcd92 Darwin/aarch64: Respect iOS ABI re: stack argument alignment 2014-02-05 14:28:59 -05:00
Zachary Waldowski 0a333d6c39 Darwin/aarch64: Fix size_t assumptions 2014-02-05 14:28:59 -05:00
Zachary Waldowski 2c18e3c76a Darwin/aarch64: Fix "shadows declaration" warnings 2014-02-05 14:28:58 -05:00
Zachary Waldowski 1b8a8e20e3 Darwin/aarch64: Use Clang cache invalidation builtin 2014-02-05 14:28:58 -05:00
Zachary Waldowski 6030cdcae7 Darwin/aarch64: Account for long double being equal to double 2014-02-05 14:28:58 -05:00
Zachary Waldowski 5658b08926 Darwin/aarch64: Use CNAME, restrict .size like ARM 2014-02-05 14:28:58 -05:00
Zachary Waldowski 0717578080 Darwin/aarch64: Fix invalid reference in assembly 2014-02-05 14:28:58 -05:00
Zachary Waldowski 9da28b4427 Darwin/x86_64: Fix 64-bit type shortening warnings 2014-02-05 14:28:58 -05:00
Zachary Waldowski 6eff9ff9e7 Darwin/iOS: Improve unified syntax use for LLVM 2014-02-05 14:28:58 -05:00
Zachary Waldowski ba0ea99c82 Fix dlmalloc warnings due to set_segment_flags, sizeof(size_t) 2014-02-05 14:28:58 -05:00
Zachary Waldowski 994be3a5c1 Darwin/iOS: Fix mis-typing of vfp_reg_free 2014-02-05 14:28:58 -05:00
Zachary Waldowski a8e0a835ab Darwin/ARM: Assert on NULL dereference
This inhibits an analyzer warning by Clang on all platforms.
2014-02-05 14:28:58 -05:00
Zachary Waldowski 1367534158 Darwin/i386: Inhibit Clang previous prototype warnings 2014-02-05 14:28:53 -05:00
Zachary Waldowski 66469c381e Darwin/ARM: Inhibit Clang previous prototype warnings 2014-02-05 14:28:49 -05:00
Zachary Waldowski 5bfe62a00d Darwin/AArch64: Inhibit Clang previous prototype warnings 2014-01-09 13:41:27 -05:00
Marcus Comstedt fa5f25c20f Linux/ppc64: Remove assumption on contents of r11 in closure 2014-01-04 19:00:08 +01:00
Paulo Pizarro 1a0b01e171 When the function called by the ffi called a function defined in a shared library generate a fatal error
The correction was to take into consideration the GOT.
2014-01-02 16:17:59 -02:00
Anthony Green 3dc3f32c35 Undo iOS ARM64 changes. 2013-12-05 16:23:25 -05:00
Zachary Waldowski 0278284e47 Darwin/aarch64: size_t assumptions 2013-11-30 12:02:18 -05:00
Zachary Waldowski 9775446b64 Darwin/aarch64: Fix “shadows declaration” warnings 2013-11-30 04:17:00 -05:00
Zachary Waldowski 4260badc37 Darwin/aarch64: Use Clang cache invalidation builtin 2013-11-30 04:16:58 -05:00
Zachary Waldowski 9fa7998d5f Darwin/aarch64: Inhibit Xcode warning 2013-11-30 04:16:56 -05:00
Zachary Waldowski 0e832048a9 Darwin/aarch64: double == long double 2013-11-30 04:16:53 -05:00
Zachary Waldowski b513dfe79d Darwin/aarch64: Restrict .size to ELF like arm32. 2013-11-30 04:16:50 -05:00
Zachary Waldowski bc978099bf Darwin/aarch64: Potentially(?) fix compile error 2013-11-30 04:16:48 -05:00
Zachary Waldowski d6bb931446 Darwin/aarch64: Use CNAME refs 2013-11-30 04:16:45 -05:00