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
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
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
Anthony Green
1cee07be47
Remove compiler warning
2014-06-12 06:30:59 -04:00
Samuli Suominen
978c954015
Add missing GNU stack markings in win32.S
2014-05-31 08:53:10 -04:00
Mickaël Salaün
c1166d4f65
closures: Check for mkostemp(3)
2014-05-19 23:11:33 +02:00
Mickaël Salaün
8daeed9570
closures: Create temporary file with O_TMPFILE and O_CLOEXEC when available
...
The open_temp_exec_file_dir function can create a temporary file without
file system accessible link. If the O_TMPFILE flag is not defined (old
Linux kernel or libc) the behavior is unchanged.
The open_temp_exec_file_name function now need a new argument "flags"
(like O_CLOEXEC) used for temporary file creation.
The O_TMPFILE flag allow temporary file creation without race condition.
This feature/fix prevent another process to access the (future)
executable file from the file system.
The O_CLOEXEC flag automatically close the temporary file for any
execve. This avoid transmitting (executable) file descriptor to a child
process.
2014-05-19 23:11:33 +02:00
Magnus Granberg
52b3457093
Check /proc/self/status for PaX status.
2014-05-11 09:55:28 -04:00
Josh Triplett
99909eb618
src/x86/win32.S: Define ffi_closure_FASTCALL in the MASM section, too
2014-04-22 21:17:52 -07:00
Josh Triplett
d36952273d
Support fastcall closures
...
libffi on 32-bit x86 now supports closures for all supported ABIs.
Thus, rewrite the last remaining duplicated-by-ABI test (closure_stdcall
and closure_thiscall) to use the generic ABI_NUM/ABI_ATTR mechanism.
2014-04-20 17:08:37 -07:00
Anthony Green
8fa2812355
Merge pull request #116 from frida/fix/darwin-aarch64-variadic
...
Fix handling of variadic calls on Darwin/AArch64
2014-04-12 19:32:08 -04:00
Anthony Green
8a58e6b780
Merge pull request #115 from frida/fix/darwin-aarch64-alignment
...
Fix alignment of AArch64 assembler functions
2014-04-12 19:30:18 -04:00
Ole André Vadla Ravnås
3e2b84d295
Fix Windows regression
...
Introduced by b5fed60194 .
2014-04-12 01:06:09 +02:00
Ole André Vadla Ravnås
419503f409
Fix handling of variadic calls on Darwin/AArch64
2014-04-06 20:59:25 +02:00
Ole André Vadla Ravnås
a539f7ffd6
Fix alignment of AArch64 assembler functions
2014-04-06 20:57:32 +02:00
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