Richard Henderson
3ac1610aa3
x86: Fix cygwin32 build
...
The section syntax is just that little bit different.
2015-01-19 20:48:40 +01:00
Rainer Orth
f1560b7bbe
x86: Solaris fixes
...
* Solaris/x86 /bin/as doesn't support .org, so I've just disabled the
uses in src/x86/{sysv, unix64}.S, as on Darwin.
* Solaris/x86 needs to use EH_FRAME_FLAGS so manually and compiler
generated .eh_frame sections match, otherwise libffi.so fails to link:
* Solaris/x86 /bin/as has different COMDAT syntax; I've disabled it for
the moment.
2015-01-16 11:32:11 -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
Anthony Green
1c61e73ad8
Merge pull request #165 from rth7680/pcc
...
Support PCC as producer and consumer
2015-01-10 09:23:30 -05:00
Anthony Green
dd0b59a5cf
Merge pull request #164 from rth7680/darwin
...
Fix build on darwin
2015-01-10 09:22:55 -05:00
Anthony Green
9131039c93
Merge pull request #160 from nobu/msvc-no-complex
...
x86: MSVC does not support Complex type
2015-01-10 09:22:42 -05: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
Iain Sandoe
ae842a515b
x86: More Darwin unwind fixups
...
EHFrame{N} IIRC is a special cue to ld64 that it should treat the unwind
in the object as "special/legacy" .. [these days everything is .cfi_xxxx
(except, cctools-as, as you noted)] .. without that much confusion arises
with ld64's atom-isation of the eh_frame section.
xxxx.eh labels are not needed for darwin ld64 >= 85.2.1 (i.e. darwin9,
xcode 3.1.4) to all intents and purposes, that's all that matters now,
since I think that anyone trying to build on 10.4/darwin8/xcode2.5 would
have to use a later ld64 (from odcctools) for other reasons.
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
Nobuyoshi Nakada
7282d3289c
x86: MSVC does not support Complex type
2014-12-22 17:14:40 +09:00
Nobuyoshi Nakada
5f8881a591
x86: Fix void pointer arithmetic
2014-12-22 17:08:08 +09: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
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
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
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
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
Anthony Green
a0bdc5250c
Fix typo
2014-11-11 09:43:01 -05:00
Anthony Green
6695983d2f
Add complex type support. Mostly broken right now
2014-09-20 07:44:37 -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
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
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
Samuli Suominen
978c954015
Add missing GNU stack markings in win32.S
2014-05-31 08:53:10 -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
Ole André Vadla Ravnås
3e2b84d295
Fix Windows regression
...
Introduced by b5fed60194 .
2014-04-12 01:06:09 +02:00