|
205cf01b
|
2021-03-23T11:31:08
|
|
Bug #680. Don't accept floats or small ints as var args. (#628)
* Bug #680. Don't accept floats or small ints as var args.
* Bug #680. Don't accept floats or small ints as var args.
* Bug #680. Don't accept floats or small ints as var args.
|
|
9ba55921
|
2021-03-05T10:07:30
|
|
Static tramp v5 (#624)
* Static Trampolines
Closure Trampoline Security Issue
=================================
Currently, the trampoline code used in libffi is not statically defined in
a source file (except for MACH). The trampoline is either pre-defined
machine code in a data buffer. Or, it is generated at runtime. In order to
execute a trampoline, it needs to be placed in a page with executable
permissions.
Executable data pages are attack surfaces for attackers who may try to
inject their own code into the page and contrive to have it executed. The
security settings in a system may prevent various tricks used in user land
to write code into a page and to have it executed somehow. On such systems,
libffi trampolines would not be able to run.
Static Trampoline
=================
To solve this problem, the trampoline code needs to be defined statically
in a source file, compiled and placed in the text segment so it can be
mapped and executed naturally without any tricks. However, the trampoline
needs to be able to access the closure pointer at runtime.
PC-relative data referencing
============================
The solution implemented in this patch set uses PC-relative data references.
The trampoline is mapped in a code page. Adjacent to the code page, a data
page is mapped that contains the parameters of the trampoline:
- the closure pointer
- pointer to the ABI handler to jump to
The trampoline code uses an offset relative to its current PC to access its
data.
Some architectures support PC-relative data references in the ISA itself.
E.g., X64 supports RIP-relative references. For others, the PC has to
somehow be loaded into a general purpose register to do PC-relative data
referencing. To do this, we need to define a get_pc() kind of function and
call it to load the PC in a desired register.
There are two cases:
1. The call instruction pushes the return address on the stack.
In this case, get_pc() will extract the return address from the stack
and load it in the desired register and return.
2. The call instruction stores the return address in a designated register.
In this case, get_pc() will copy the return address to the desired
register and return.
Either way, the PC next to the call instruction is obtained.
Scratch register
================
In order to do its job, the trampoline code would need to use a scratch
register. Depending on the ABI, there may not be a register available for
scratch. This problem needs to be solved so that all ABIs will work.
The trampoline will save two values on the stack:
- the closure pointer
- the original value of the scratch register
This is what the stack will look like:
sp before trampoline ------> --------------------
| closure pointer |
--------------------
| scratch register |
sp after trampoline -------> --------------------
The ABI handler can do the following as needed by the ABI:
- the closure pointer can be loaded in a desired register
- the scratch register can be restored to its original value
- the stack pointer can be restored to its original value
(the value when the trampoline was invoked)
To do this, I have defined prolog code for each ABI handler. The legacy
trampoline jumps to the ABI handler directly. But the static trampoline
defined in this patch jumps tp the prolog code which performs the above
actions before jumping to the ABI handler.
Trampoline Table
================
In order to reduce the trampoline memory footprint, the trampoline code
would be defined as a code array in the text segment. This array would be
mapped into the address space of the caller. The mapping would, therefore,
contain a trampoline table.
Adjacent to the trampoline table mapping, there will be a data mapping that
contains a parameter table, one parameter block for each trampoline. The
parameter block will contain:
- a pointer to the closure
- a pointer to the ABI handler
The static trampoline code would finally look like this:
- Make space on the stack for the closure and the scratch register
by moving the stack pointer down
- Store the original value of the scratch register on the stack
- Using PC-relative reference, get the closure pointer
- Store the closure pointer on the stack
- Using PC-relative reference, get the ABI handler pointer
- Jump to the ABI handler
Mapping size
============
The size of the code mapping that contains the trampoline table needs to be
determined on a per architecture basis. If a particular architecture
supports multiple base page sizes, then the largest supported base page size
needs to be chosen. E.g., we choose 16K for ARM64.
Trampoline allocation and free
==============================
Static trampolines are allocated in ffi_closure_alloc() and freed in
ffi_closure_free().
Normally, applications use these functions. But there are some cases out
there where the user of libffi allocates and manages its own closure
memory. In such cases, static trampolines cannot be used. These will
fall back to using legacy trampolines. The user has to make sure that
the memory is executable.
ffi_closure structure
=====================
I did not want to make any changes to the size of the closure structure for
this feature to guarantee compatibility. But the opaque static trampoline
handle needs to be stored in the closure. I have defined it as follows:
- char tramp[FFI_TRAMPOLINE_SIZE];
+ union {
+ char tramp[FFI_TRAMPOLINE_SIZE];
+ void *ftramp;
+ };
If static trampolines are used, then tramp[] is not needed to store a
dynamic trampoline. That space can be reused to store the handle. Hence,
the union.
Architecture Support
====================
Support has been added for x64, i386, aarch64 and arm. Support for other
architectures can be added very easily in the future.
OS Support
==========
Support has been added for Linux. Support for other OSes can be added very
easily.
Signed-off-by: Madhavan T. Venkataraman <madvenka@linux.microsoft.com>
* x86: Support for Static Trampolines
- Define the arch-specific initialization function ffi_tramp_arch ()
that returns trampoline size information to common code.
- Define the trampoline code mapping and data mapping sizes.
- Define the trampoline code table statically. Define two tables,
actually, one with CET and one without.
- Introduce a tiny prolog for each ABI handling function. The ABI
handlers addressed are:
- ffi_closure_unix64
- ffi_closure_unix64_sse
- ffi_closure_win64
The prolog functions are called:
- ffi_closure_unix64_alt
- ffi_closure_unix64_sse_alt
- ffi_closure_win64_alt
The legacy trampoline jumps to the ABI handler. The static
trampoline jumps to the prolog function. The prolog function uses
the information provided by the static trampoline, sets things up
for the ABI handler and then jumps to the ABI handler.
- Call ffi_tramp_set_parms () in ffi_prep_closure_loc () to
initialize static trampoline parameters.
Signed-off-by: Madhavan T. Venkataraman <madvenka@linux.microsoft.com>
* i386: Support for Static Trampolines
- Define the arch-specific initialization function ffi_tramp_arch ()
that returns trampoline size information to common code.
- Define the trampoline code table statically. Define two tables,
actually, one with CET and one without.
- Define the trampoline code table statically.
- Introduce a tiny prolog for each ABI handling function. The ABI
handlers addressed are:
- ffi_closure_i386
- ffi_closure_STDCALL
- ffi_closure_REGISTER
The prolog functions are called:
- ffi_closure_i386_alt
- ffi_closure_STDCALL_alt
- ffi_closure_REGISTER_alt
The legacy trampoline jumps to the ABI handler. The static
trampoline jumps to the prolog function. The prolog function uses
the information provided by the static trampoline, sets things up
for the ABI handler and then jumps to the ABI handler.
- Call ffi_tramp_set_parms () in ffi_prep_closure_loc () to
initialize static trampoline parameters.
Signed-off-by: Madhavan T. Venkataraman <madvenka@linux.microsoft.com>
* arm64: Support for Static Trampolines
- Define the arch-specific initialization function ffi_tramp_arch ()
that returns trampoline size information to common code.
- Define the trampoline code mapping and data mapping sizes.
- Define the trampoline code table statically.
- Introduce a tiny prolog for each ABI handling function. The ABI
handlers addressed are:
- ffi_closure_SYSV
- ffi_closure_SYSV_V
The prolog functions are called:
- ffi_closure_SYSV_alt
- ffi_closure_SYSV_V_alt
The legacy trampoline jumps to the ABI handler. The static
trampoline jumps to the prolog function. The prolog function uses
the information provided by the static trampoline, sets things up
for the ABI handler and then jumps to the ABI handler.
- Call ffi_tramp_set_parms () in ffi_prep_closure_loc () to
initialize static trampoline parameters.
Signed-off-by: Madhavan T. Venkataraman <madvenka@linux.microsoft.com>
* arm: Support for Static Trampolines
- Define the arch-specific initialization function ffi_tramp_arch ()
that returns trampoline size information to common code.
- Define the trampoline code mapping and data mapping sizes.
- Define the trampoline code table statically.
- Introduce a tiny prolog for each ABI handling function. The ABI
handlers addressed are:
- ffi_closure_SYSV
- ffi_closure_VFP
The prolog functions are called:
- ffi_closure_SYSV_alt
- ffi_closure_VFP_alt
The legacy trampoline jumps to the ABI handler. The static
trampoline jumps to the prolog function. The prolog function uses
the information provided by the static trampoline, sets things up
for the ABI handler and then jumps to the ABI handler.
- Call ffi_tramp_set_parms () in ffi_prep_closure_loc () to
initialize static trampoline parameters.
Signed-off-by: Madhavan T. Venkataraman <madvenka@linux.microsoft.com>
|
|
93cf288d
|
2020-10-27T07:05:28
|
|
testsuite: Add a missing include of <inttypes.h> to fix build failure in test suite (#587)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
|
2e90bb55
|
2020-06-07T14:31:06
|
|
Add gcc bug tests back
|
|
5dcb741f
|
2019-11-23T10:24:58
|
|
Move nested_struct3 test to closures directory
|
|
1aca3330
|
2019-11-23T09:42:04
|
|
Add missing closing brace
|
|
c72b82f4
|
2019-11-23T08:48:53
|
|
Remove junk file from dist
|
|
642d40ee
|
2019-11-23T07:49:58
|
|
Account for moved test files
|
|
049da08a
|
2019-11-23T07:44:26
|
|
Add dejagnu directives accidentally removed
|
|
36730f5d
|
2019-11-22T19:49:38
|
|
Move closure test to closure directory
|
|
c88c0e92
|
2019-11-22T19:27:34
|
|
More more closure tests to the closure test directory
|
|
332a539e
|
2019-11-22T18:54:30
|
|
Move closure tests so we can easily XFAIL them for some targets
|
|
1761a106
|
2019-11-22T18:53:09
|
|
Remove gccbug detection. GCC is good now.
|
|
91a7fbe9
|
2019-11-20T07:16:41
|
|
Fix or1k lack-of-g++ checking in testsuite
|
|
bd3a4687
|
2019-11-19T17:14:23
|
|
No C++ for or1k-unknown-elf
|
|
d6e4f96b
|
2019-11-19T13:36:49
|
|
No C++ for or1k
|
|
49701868
|
2019-11-19T10:07:16
|
|
Disable type warnings for or1k.
|
|
262cf74f
|
2019-11-19T10:06:57
|
|
No c++ for or1k-elf
|
|
188de63c
|
2019-11-07T12:03:19
|
|
Mark xfail for m68k and alpha.
|
|
1d605944
|
2019-10-24T05:25:11
|
|
Add missing dist files.
|
|
825b2a35
|
2019-10-16T16:05:46
|
|
Test on arm32v7-linux-gnu, ppc64le-linux-gnu and aarch64-linux-gnu.
Use docker images and qemu to test libffi for non-x86 architectures on
travis-ci.
Use the LIBFFI_TEST_OPTIMIZATION environment variable to
force specific optimization levels at test time.
|
|
09f9d856
|
2019-10-09T16:26:06
|
|
Making the change to correct the comment when SUN (#521)
and GCC are used together
|
|
042ef8c3
|
2019-02-12T08:50:30
|
|
Remove -Os testing. No ABI impact, and helps trim log lengths.
|
|
8206253f
|
2018-05-09T10:50:46
|
|
Mark some cases as xfail due to GCC bug
|
|
d3c54cf3
|
2018-05-02T06:19:58
|
|
Re-enable msabi testing (#436)
* Revert "disable msabi testing for now"
This reverts commit 7b7638eb0eac2adfa72f7ec9f254ba287c9947e2.
* x86: Correct testing for 64-bit x86-64
Since passing -m32 to x86-64 compiler will generate i386 code, we
need to check both __ILP32__ and __i386__ for 64-bit x86-64.
* x86: Check __i386__ instead of i?86-*-* targets
Since passing -m32 to x86-64 compiler will generate i386 code, we need
to check __i386__ instead of i?86-*-* targets for i386 targets.
* i386: Properly passing integer parameters in registers
For thiscall and fastcall, if the paramter passed as 64-bit integer or
struct, all following integer paramters will be passed on stack.
* test: Add ABI_ATTR to callback_code
Add ABI_ATTR to callback_code to properly test different ABIs.
|
|
801c1bd7
|
2018-04-05T14:27:32
|
|
Fix issue #421 (#422)
Fantastic - thanks for digging into this.
|
|
7b7638eb
|
2018-04-02T08:24:44
|
|
disable msabi testing for now
|
|
af6773d6
|
2018-04-02T13:55:31
|
|
Fix appveyor windows build (#420)
* Fix msvcc dll build by adding dllexport decorations to all API declarations
* Fix appveyor build for VS 2013
Use the new -DFFI_BUILDING_DLL for producing a working DLL. Update the
msvcc.sh wrapper script to successfully compile the testsuite files.
* MSVC build: suppress warnings in testsuite
* fix testsuite on appveyor
|
|
48bdb028
|
2018-03-29T07:22:57
|
|
Trim some optimization tests
|
|
fa72b054
|
2018-03-29T07:10:23
|
|
Remove warning message from clang
|
|
746c3ce2
|
2018-03-29T07:01:14
|
|
Expand ABI tests on x86. Testsuite bug fixes.
|
|
e8cf1338
|
2018-03-27T14:12:02
|
|
msvc c99 hack
|
|
a3e20940
|
2018-03-27T11:58:42
|
|
More msvc hacks
|
|
a82b456e
|
2018-03-27T11:49:46
|
|
msvc fixes
|
|
85b6b209
|
2018-03-27T11:35:23
|
|
Force literals to float (msvc warning)
|
|
5c2ca479
|
2018-03-27T04:01:37
|
|
Remove uninitialized warning. Fix #163.
|
|
247e44b3
|
2018-03-18T07:01:54
|
|
Fix return values
|
|
1f99701f
|
2018-03-17T22:49:58
|
|
Make tests compile/run standalone
|
|
a33bfa9b
|
2018-03-17T07:17:24
|
|
xfail unwind tests for moxie
|
|
d2f7e788
|
2018-03-14T09:06:38
|
|
Fix test cases with short results
|
|
16313cb2
|
2018-03-13T08:52:30
|
|
Support compiler specific warning suppression flags
|
|
cca6d1fb
|
2018-03-13T08:51:34
|
|
Support compiler specific warning suppression flags
|
|
9291f941
|
2018-03-13T08:37:21
|
|
Add bhaible's missing Makefile
|
|
bede01d8
|
2018-03-13T07:53:33
|
|
Remove stray directory
|
|
ddf7a8f7
|
2018-03-13T07:47:57
|
|
Update test list for dist
|
|
6186261c
|
2018-03-12T21:53:18
|
|
Add Bruno Haible and Bill Triggs' libffi testsuite
|
|
45da2fcb
|
2018-02-17T18:53:02
|
|
new test: return small struct
The bug originally was discovered in https://bugs.gentoo.org/634190
where complicated callback was returning invalid data on ia64.
This change adds minimal reproducer that fails only on ia64 as:
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O0 execution test
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O2 execution test
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O3 execution test
FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -Os execution test
Test passes on amd64. The fix is in the following commit.
Bug: https://bugs.gentoo.org/634190
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
|
1fb788ac
|
2017-10-10T11:37:00
|
|
aarch64: fix index base register for AArch64
The base is passed in `x3`, not in `x2`. This fixes the indexing base
so that the right value is used.
|
|
b2a343ff
|
2017-10-25T04:36:49
|
|
Don't include WIN64/EFI64 for x32
Since x32 doesn't support WIN64/EFI64, don't include it for x32. Also
x32 has sizeof size_t == 4. But TARGET should be X86_64.
|
|
c9c2aa24
|
2017-03-15T09:58:39
|
|
Revert previous two changes. clang/MacOS problem can only be solved within dejagnu.
|
|
5a8fca94
|
2017-03-15T09:52:39
|
|
Fix typo
|
|
5b10a019
|
2017-03-15T09:34:01
|
|
Work around dejagnu/clang problems
|
|
c5b408ee
|
2016-09-04T09:17:46
|
|
xfail the unwindtest for osx as per issue #279
|
|
ef8be84d
|
2016-07-29T21:01:38
|
|
Do not use fabsl() in float2.c test
Some targets may support long double variables but in the same
time may lack support of long double functions like fabsl().
Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
|
|
f3201733
|
2016-07-29T19:18:41
|
|
Fix output expectations in cls_dbls_struct.c test
This test with invalid output expectations may fail on some targets
(e.g. ARC processors).
Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
|
|
f74ea2dc
|
2016-07-28T20:57:09
|
|
Allow setting an arbitary value for blddirffi in testsuite
It is useful when tests are executed not from build directory. So
the path of the build directory may be passed through site.exp or
runtest.
Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
|
|
31362d78
|
2016-07-28T18:48:23
|
|
ARC: Link tests with pthread library
Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
|
|
02089a1b
|
2016-05-23T09:58:51
|
|
Merge pull request #237 from tschwinge/libffi_feature_test
Simplify/fix libffi_feature_test
|
|
e5843a3a
|
2016-04-15T16:10:08
|
|
x86: Fix calling convention for ffi_closure_win64_inner
Also enable testing for the cross-abi calls.
|
|
c8845517
|
2016-02-25T20:10:18
|
|
Simplify/fix libffi_feature_test
As detailed in
<http://news.gmane.org/find-root.php?message_id=%3C87wppswqqt.fsf%40kepler.schwinge.homeip.net%3E>,
the original code (originally added in commit
f1301a54bb80e6ae23f7687c68f36875dae69134 as part of pull request #145) does not
work (at least not for me, in the GCC environment).
|
|
38a4d72c
|
2015-11-17T21:18:20
|
|
add ffi_get_struct_offsets
|
|
755f1e64
|
2016-02-20T06:43:48
|
|
Merge pull request #193 from rth7680/fix-70
Test case from issue #70
|
|
89b76050
|
2015-10-19T15:33:23
|
|
Fix dejagnu test support for --tool_opts
Right now it concatenates it with the existing options and then appends
it to that list, fix it to simply append it as is, same as it is done
with the other variables.
Tested by running the following command which includes gcc options:
$ make check RUNTESTFLAGS="--tool_opts '-Werror'"
Without this patch, all the tests fail. With it, the test succeed.
Inspecting the logs shows that -Werror was indeed used when compiling
the test sources.
|
|
4cdedc27
|
2015-07-25T14:29:15
|
|
Tidy call.exp test collection
Commit c952a92e20aa6013d8202d0b3fa1d87838c83054 moved all of
the complex tests to libffi.complex, but failed to remove the
anti-globbing from libffi.call.
|
|
609db2fb
|
2015-07-25T12:42:04
|
|
Test case from Issue #70
|
|
5cd411ad
|
2015-01-13T15:44:03
|
|
New test case for old aarch64 bug
|
|
ccdd7bb8
|
2014-11-16T12:12:23
|
|
testsuite: Fix alpha static chain register name
|
|
3316b666
|
2014-11-15T07:31:41
|
|
Merge pull request #145 from rth7680/master
Configure and testsuite cleanups, v2
|
|
c9f5b664
|
2014-11-14T13:04:33
|
|
testsuite: Add trivial tests for Go closures
|
|
c952a92e
|
2014-11-14T11:00:14
|
|
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.
|
|
f1301a54
|
2014-11-14T10:50:29
|
|
testsuite: Use feature test rather than enumeration for complex
|
|
b5ade2fb
|
2014-11-13T09:06:10
|
|
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.
|
|
771fabc6
|
2014-11-14T14:21:35
|
|
Take a float absolute value using fabs() instead of abs().
Replace integer abs() by floating point fabs() in the approximate
equality check for float values.
|
|
9622ede2
|
2014-11-14T13:18:04
|
|
Fix floating point number comparisons in testsuite/libffi.call/float[123].c.
Rewrite the checks for approximate equality of floating point return
values to be in the form "fabs(a - b) < EPS" instead of just
"a - b < EPS".
|
|
ad89c2d9
|
2014-10-26T13:16:03
|
|
sparc: Add support for complex types
|
|
a529bec2
|
2014-10-21T11:26:59
|
|
arm: Add support for complex types
|
|
f41bec3b
|
2014-10-17T20:46:48
|
|
alpha: Add support for complex types
|
|
a992f878
|
2014-10-22T22:58:09
|
|
aarch64: Add support for complex types
|
|
198f469e
|
2014-11-05T16:34:41
|
|
x86: Add support for Complex
|
|
7cf84132
|
2014-11-07T06:56:55
|
|
testsuite: Add two dg-do run markers
Caught by clang warning about unused -L parameter.
|
|
fc501750
|
2014-11-05T16:33:44
|
|
testsuite: Fix return_complex2 vs excessive precision
Use the previously computed rc2 to validate, rather than
recomputing a floating point result with excess precision.
|
|
99db4d42
|
2014-10-23T14:12:18
|
|
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.
|
|
990eb9d4
|
2014-09-28T00:50:29
|
|
Only run the complex type tests on supported platforms.
|
|
fbbf48fb
|
2014-09-20T07:43:51
|
|
Compile tests with -Wno-psabi when using GCC
|
|
6e8a4460
|
2014-09-20T06:21:19
|
|
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.
|
|
70c303cb
|
2014-05-11T09:56:40
|
|
Fix testsuite for GCC 4.9.0
|
|
d3695227
|
2014-04-20T12:03:25
|
|
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.
|
|
7d698125
|
2014-03-26T23:17:56
|
|
Use the proper C++ compiler to run C++ tests
Running the C compiler with -shared-libgcc -lstdc++ does not work on
non-GCC compilers.
|
|
9946a92a
|
2014-03-26T20:18:58
|
|
Stop looking for expect and runtest above top_builddir
Users wishing to test hand-compiled versions of expect and runtest can
easily enough put them in their path or set EXPECT and RUNTEST
themselves.
|
|
acb20232
|
2014-03-26T20:18:41
|
|
Stop setting an empty AM_RUNTESTFLAGS
|
|
e48918ec
|
2014-03-16T20:29:27
|
|
testsuite: Add ABIs to the test matrix; unify tests across ABIs
This eliminates all the *_win32.c tests in favor of the tests they were
branched from, and expands test coverage to run many more tests on
stdcall, thiscall, and fastcall.
This same mechanism also supports testing any other target that has
multiple ABIs.
|
|
4d4d368e
|
2014-03-16T17:02:05
|
|
testsuite: Replace ffitestcxx.h with ffitest.h
ffitest.h contains a superset of the functionality of ffitestcxx.h;
make the C++ tests include ffitest.h instead, and remove ffitestcxx.h.
|
|
0d9cce8e
|
2014-03-16T16:22:58
|
|
testsuite: ffitest.h: Parenthesize the CHECK macro
|
|
3f97cf34
|
2014-03-16T16:53:42
|
|
testsuite: Unify the C and C++ testsuites
These two testsuites differ only in the source file glob and a couple of
additional compiler options; unify the remaining bits.
|
|
5695ec14
|
2014-03-16T16:04:58
|
|
testsuite: Factor out a function to run a matrix of tests
This commons up code from libffi.call/call.exp and
libffi.special/special.exp, unifies the optimization option matrix
between the two, and makes it easier to add more axes to the matrix
in the future.
|
|
dfdb02cc
|
2014-03-16T15:26:26
|
|
testsuite: Introduce a __THISCALL__ compiler-specific macro
|
|
bad89483
|
2014-03-16T15:16:18
|
|
testsuite: Introduce a __STDCALL__ compiler-specific macro
Several tests want to use stdcall, which differs in syntax by compiler,
so introduce a macro for it in ffitest.h.
|
|
98a793fa
|
2014-03-16T15:20:36
|
|
testsuite: Common up the ifdef blocks for compiler-specific macros
|
|
e1911f78
|
2014-03-16T03:25:53
|
|
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.
|
|
9c279328
|
2014-03-16T02:31:19
|
|
testsuite: Remove fragile stack pointer checks
testsuite/libffi.call/closure_stdcall.c and
testsuite/libffi.call/closure_thiscall.c include inline assembly to save
the stack pointer before and after the call, and compare the values.
However, compilers can and do leave the stack in different states for
these two pieces of inline assembly, such as by saving a temporary value
on the stack across the call; observed with gcc -Os, and verified as
spurious through careful inspection of disassembly.
|