testsuite


Log

Author Commit Date CI Message
Hood Chatham 7d23c2d2 2023-02-09T06:01:37 Add emscripten gha workflow (#768) Resolves issue #767
Hood Chatham 678dad5a 2023-02-02T14:48:07 Use libffi-dg-prune to handle Emscripten INFO messages rather than patching emcc.py (#766)
Hood Chatham 2687cfc5 2023-02-02T09:10:00 Add wasm32 emscripten support (#763) * added build script * Apply libffi-emscripten patch * Some changes to wasm32/ffi.c * Remove exit(0); from test suites * Fix LONGDOUBLE argument type * Use more macros in ffi.c * Use switch statements instead of if chains * Implemented struct args * Finish struct implementation * Partially working closures * Got closures working (most of closures test suite passes) * Revert changes to test suite * Update .gitignore * Apply code formatter * Use stackSave and stackRestore rather than directly adjusting stack pointer * Add missing break * Fix visibility of ffi_closure_alloc and ffi_closure_free * Fix FFI_TYPE_STRUCT and FFI_TYPE_LONGDOUBLE when WASM_BIGINT is not used sig needs to be vi here for FFI_TYPE_STRUCT and FFI_TYPE_LONGDOUBLE, noticed this while running the test suite without WASM_BIGINT support. * Always use dynCall rather than direct wasmTable lookup (function pointer cast emulation changes dynCall) * Prevent closures.c from duplicating symbols * Try to set up CI * Add test with bigint * Make test methods static * Remove BigInt shorthand because it messes up terser * Add selenium tests * Update tests a bit to try to make CI work * WASM_BIGINT is a linker flag not a compile flag * Finish getting CI working (#1) * update gitignore * Avoid adding "use strict;" to generated JS This should be controlled by -s STRICT_JS in Emscripten. * Make JavaScript ES5 compliant * Remove redundant EXPORTED_RUNTIME_METHODS settings * Fix definition of DEREF_I16 * Avoid marshalling FFI_TYPE_LONGDOUBLE when WASM_BIGINT is not used * Add missing FFI_TYPE_STRUCT signature * Improve test scripts * Remove redundant EXPORTED_RUNTIME_METHODS settings * Add missing EOL * Add struct unpacking tests * Update ci config to try to actually use WASM_BIGINT * Revert "Avoid marshalling FFI_TYPE_LONGDOUBLE when WASM_BIGINT is not used" This reverts commit 61bd5a3e20891623715604581b6e872ab3dfab80. * Fix single_entry_structs tests * Fix return from closure call * Fix 64 bit return from closures * only allocate as much space on stack for return pointer as needed * Revert "only allocate as much space on stack for return pointer as needed" This reverts commit e54a30faea3803e7ac33eed191bde9e573850fc1. * xfail two tests * Fix err_bad_abi test * Remove test logging junk * Try to set up long double marshalling for closures * xfail err_bad_abi * Fix reference errors in previous commit * Add missing argument pointer assignment * Fix signature of function pointer in cls_dbls_struct * Fix longdouble argument * Try some changes to bigint handling * Fix BigInt handling * Fix cls_longdouble test * Fix long double closure arg with no WASM_BIGINT * Use EM_JS to factor out js helpers * Support for varargs closure calls * Fix varargs calls * Fix err_bad_abi test * Fix typo in previous commit * Add more assertions to closures test suite * Fix some asserts * Add assertions to a few more tests * Fix some tests * Fix more floating point assertions * Update more tests * Var args for ffi_call * Don't do node tests * Macro for allocating on stack * Add some comments, simplify struct handling * Try again to fix varargs calls, add comments * Consolidate WASM_BIGINT conditionals into LOAD_U64 and STORE_U64 macros * A bit of cleanup * Fix another typo * Some fixes to the testsuite * Another testsuite fix * Fix varags with closures? * Another attempt at getting closure varargs to work * sig is initialized later * Allow libffi.closures tests to be run * Improve build script * Remove redundant semicolons * Fix a few libffi.closures test failures * Cleanup * Legacy dynCall API is no longer used * Fix FFI_TYPE_LONGDOUBLE offset * xfail 2 tests for WASM - closure_loc_fn0; not applicable -- codeloc doesn't point to closure. - huge_struct; function signature too long. * Revert some redundant dg-output/printf statements Helps Node. * Revert "Don't do node tests" This reverts commit a341ef4b. * Fix assertions in cls_24byte * More tiny formating fixes to test suite * Revert "Revert "Don't do node tests"" This reverts commit 7722e685ea04e2420e042886816d8c4dd31f5dcb. * Fix 64 bit returns when WASM_BIGINT is absent * Fix print statement in cls_24byte * Add CALL_FUNC_PTR macro to allow pyodide to define custom calling behavior to handle fpcast * Update single_entry_structs tests * More explanations * Fix compile error in last commit * Add more support for pyodide fpcast emulation, update CI to try to test it * Clone via https * Fix path to pyodide emsdk_env * Add asserts to the rest of the test suite * Fix test compile errors * Fix some tests * Fix cls_ulonglong * Fix alignment of <4 byte args * fix cls_ulonglong again * Use snprintf instead of sprintf * Should assert than strncmp returned 0 * Fix va_struct1 and va_struct3 * Change double and long double tests These tests are failing because of a strange bug with prinft and doubles, but I am not convinced it necessarily has anything to do with libffi. This version casts the double to int before printing it and avoids the issue * Enable node tests * Revert "Change double and long double tests" This reverts commit 8f3ff89c6577dc99564181cd9974f2f1ba21f1e9. * Fix PYODIDE_FPCAST flag * add conftest.py back in * Fix emcc error: setting `EXPORTED_FUNCTIONS` expects `<class 'list'>` but got `<class 'str'>` See discussion on https://github.com/pyodide/pyodide/pull/1596 * Remove test.html * Remove duplicate test file * More changes from upstream * Fix some whitespace * Add some basic debug logging statements * Reapply libffi.exp changes * Don't build docs (#7) Works around build issue makeinfo: command not found. * Update long double alignment Emscripten 2.0.26 reduces the aligmnet of long double to 8. Quoting from `ChangeLog.md`: > The alignment of `long double`, which is a 128-bit floating-point > value implemented in software, is reduced from 16 to 8. The lower > alignment allows `max_align_t` to properly match the alignment we > use for malloc, which is 8 (raising malloc's alignment to achieve > correctness the other way would come with a performance regression). > (#10072) * Update long double alignment Emscripten 2.0.26 reduces the aligmnet of long double to 8. Quoting from `ChangeLog.md`: > The alignment of `long double`, which is a 128-bit floating-point > value implemented in software, is reduced from 16 to 8. The lower > alignment allows `max_align_t` to properly match the alignment we > use for malloc, which is 8 (raising malloc's alignment to achieve > correctness the other way would come with a performance regression). > (#10072) * Improve error handling a bit (#8) * Fix handling of signed arguments to ffi_call (#11) * Fix struct argument handling in ffi_call (#10) * Remove fpcast emulation tests * Align the stack to MAX_ALIGN before making call (#12) * Increase MAX_ARGS * Cleanup (#14) * Fix Closure compiler error with -sASSERTIONS=1 (#15) * Remove function pointer cast emulation (#13) This reverts commit 593b402 and cbc54da, as it's no longer needed after PR pyodide/pyodide#2019. * Prefer the `__EMSCRIPTEN__` definition over `EMSCRIPTEN` (#18) "The preprocessor define EMSCRIPTEN is deprecated. Don't pass it to code in strict mode. Code should use the define __EMSCRIPTEN__ instead." https://github.com/emscripten-core/emscripten/blob/84a634167a1cd9e8c47d37a559688153a4ceace6/emcc.py#L887-L890 * Install autoconf 2.71 * Try again with installing autoconf 2.71 * Fix compatibility with Emscripten 3.1.28 * CI: remove use of `EM_CONFIG` env See commit: https://github.com/emscripten-core/emsdk/commit/3d87d5ea8143b3636f872fb05b896eb4a19a070b * Fix cls_multi_schar: cast rest_call to signed char * Remove test xfails (#17) * Fix long double when used as a varargs argument * Enable unwindtest and fix it * Add EM_JS_DEPS * Also require convertJsFunctionToWasm * Run tests very very verbose * Echo the .emscripten file * Remove --experimental-wasm-bigint insertion * Build with assertions * Move verbosity flags back out of LDFLAGS * Remove debug print statement * Use up to date pyodide docker image * Explicitly cast res_call to fix test failure * Put back name of main function in cls_longdouble_va.c * Fix alignment The stack pointer apparently needs to be aligned to 16. There were some terrible subtle bugs caused by not respecting this. stackAlloc knows that the stack should be 16 aligned, so we can use stackAlloc(0) to enforce this. This way if alignment requirements change, as long as Emscripten updates stackAlloc to continue to enforce them we should be okay. * Fix handling of systems with no Js bigint integration When we run the node tests we use node v14 tests (since node v14 is vendored with Emscripten). Node v14 has no Js bigint integration unless the --experimental-wasm-bigint flag is passed. So only the node tests really notice if we get this right. Turns out, it didn't work. We can't call a JavaScript function with 64 bit integer arguments without bigint integration. In ffi_call, we are trying to call a wasm function that takes 64 bit integer arguments. dynCall is designed to do this. We need to go back to tracking the signature when we don't have WASM_BIGINT, and then use dynCall. This works better now that emscripten can dynamically fill in extra dynCall wrappers: https://github.com/emscripten-core/emscripten/pull/17328 On the other hand, for the closures we are not getting a function pointer as a first argument. We need to make our own wasm legalizer adaptor that splits 64 bit integer arguments and then calls the JavaScript trampoline, then the JavaScript trampoline reassembles them, calls the closure, then splits the result (if it's a 64 bit integer) and the adaptor puts it back together. * Improvements to emscripten test shell scripts (#21) This fixes the C++ unwinding tests and makes other minor improvements to the Emscripten test shell scripts. * Rename the test folder and move test files into emscripten test folder * Use docker image that has autoconf-2.71 * Cleanup * Pin emscripten 3.1.30 * Fix build.sh path * Rearrange ci pipeline * Fix bpo_38748 test * Cleanup * Improvements to comments, add static asserts, and update copyright * Use `*_js` instead of `*_helper` for EM_JS functions (#22) * Minor code simplification * Xfail first dejagnu test to work around emscripten cache messages See https://github.com/emscripten-core/emscripten/issues/18607 * Remove unneeded xfails * Shorten conftest.py by using pytest-pyodide * Apply formatters and linters to emscripten directory * Fix Emscripten xfail hack * Fix build-tests script * Patch emscripten to quiet info messages * Clean up compiler flags in scripts and remove some settings from circleci config * Rename emscripten quiet script * Add missing export * Don't remove go.exp * Add reference to emscripten logging issue --------- Co-authored-by: Kleis Auke Wolthuizen <info@kleisauke.nl> Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl> Co-authored-by: Christian Heimes <christian@python.org>
Anthony Green e58e22b2 2023-02-02T07:02:53 From Dave Anglin: A couple of years ago the 32-bit hppa targets were converted from using a trampoline executed on the stack to the function descriptor technique used by ia64. This is more efficient and avoids having to have an executable stack. However, function pointers on 32-bit need the PLABEL bit set in the pointer. It distinguishes between pointers that point directly to the executable code and pointer that point to a function descriptor. We need the later for libffi. But as a result, it is not possible to convert using casts data pointers to function pointers. The solution at the time was to set the PLABEL bit in hppa closure pointers using FFI_CLOSURE_PTR. However, I realized recently that this was a bad choice. Packages like python-cffi allocate their own closure pointers, so this isn't going to work well there. A better solution is to leave closure pointers unchanged and only set the PLABEL bit in pointers used to point to executable code. The attached patch drops the FFI_CLOSURE_PTR and FFI_RESTORE_PTR defines. This allows some cleanup in the hppa closure routines. The FFI_FN define is now used to set the PLABEL bit on hppa. ffi_closure_alloc is modified to set the PLABEL bit in the value set in *code. I also added a FFI_CL define to convert a function pointer to a closure pointer. It is only used in one test case.
Iain Sandoe 7effe999 2023-02-02T11:42:46 Darwin: Search for both shared and convenience libraries in each path. (#761) For several Darwin linker versions, the default behaviour is to first traverse the set of library paths, looking for shared libraries, and then a second time looking for archives. This means that if the library is configured --disable-shared the installed system version /usr/lib/libffi.dylib will be found before the archive under test. Using the linker option '-search-paths-first' alters the strategy to search each path for dylib and then archive before moving on to the next.
Anthony Green c6dc125a 2022-10-25T10:28:19 Add missing test cases
Andreas Schwab 77a0fb82 2022-10-10T17:59:04 Flush output before aborting (#740) Co-authored-by: Andreas Schwab <schwab@suse.de>
Anthony Green a1467200 2022-09-26T11:41:48 Never link pthread for android
Anthony Green 55bcc477 2022-09-24T22:03:52 Test idea borrowed from cpython
Anthony Green e79f1948 2022-09-24T17:11:30 Add test case transcribed from cpython
Anthony Green f26b56e1 2022-09-19T08:15:22 Add new files for distribution
Anthony Green acf0ce9e 2022-09-18T11:04:54 Add test case
Anthony Green b49308ea 2022-09-18T08:26:23 Add missing ABI_ATTR
Hans ee22ecbd 2022-09-18T01:56:25 Add MSYS configuration files (#728) * Add MSYS configuration files MSYS behaves very similiar to Cygwin, e.g. also __CYGWIN__ is defined. Now 'make check' passes on MSYS without extra patches. * Fix warning extra tokens at end of #endif in closures.c Extra tokens converted into a comment. Also nearby indentations corrected. * Fix missing prototype warning mkostemp() on Cygwin Cygwin requires also _GNU_SOURCE to be defined to enable mkostemp() prototype. * Fix warning label ‘out’ defined but not used in ffi functions Define same preprocessor conditions for goto and label visibility. * Fix warning label ‘out’ defined but not used and related indentations. Define same preprocessor conditions for goto and label visibility. Correct also related indentations. Co-authored-by: Hannes Müller <>
Anthony Green 5e010474 2022-09-15T16:57:59 Fix test case for 64-bit mingw
Anthony Green 305cde79 2022-09-15T15:50:35 Passes on 64bit mingw
Anthony Green 98d4ad65 2022-09-15T09:42:53 Fix test headers
Anthony Green 4d0a0384 2022-09-15T07:58:26 msvc requires the printf change, not mingw
Anthony Green 19e8354f 2022-09-14T07:36:06 Fix test case
Anthony Green 4932f351 2022-09-14T07:08:06 Improve test case
Anthony Green 819b01ce 2022-09-14T07:07:15 Add test case
Anthony Green b2344575 2022-09-06T12:43:08 Fix unwindtest on macos
Anthony Green b4cf3d64 2022-09-04T07:32:18 Prune warnings from sparc64 linux ld
Anthony Green c248764d 2022-05-29T07:27:32 Update testsuite Makefile
Anthony Green 55f80b02 2022-05-28T14:17:53 New test cases
Roland Schatz de95947a 2022-05-24T03:04:43 Fix check for invalid varargs arguments. (#707)
A. Wilcox e504f90f 2022-05-23T18:42:32 testsuite/libffi.closures: Fix PowerPC 64 (#709) -mlong-double-128 is only supported on glibc. This test still passes on glibc targets, and now passes on musl targets as well (which uses 64-bit ldbl).
Anthony Green e770fb76 2022-05-22T20:43:41 Clean up types
Andreas Schwab 4fa6239f 2021-12-23T14:27:32 testsuite/libffi.call: fix mismatching return types (#679) Co-authored-by: Andreas Schwab <schwab@suse.de>
Anthony Green 03596285 2021-07-29T10:16:42 No more xfail for alpha
Anthony Green 43e4ad4d 2021-07-29T07:55:59 Test passing structs by value
Anthony Green be0b3b6e 2021-07-16T21:51:03 Fix CHECK
Anthony Green 7db17442 2021-07-16T11:30:01 Don't check the whole buffer, just what we printed.
Anthony Green 8bcf5947 2021-07-16T11:26:02 Fix test case
Anthony Green c96b0577 2021-07-16T11:16:39 Fix test check
Anthony Green 4ed23be8 2021-07-16T11:08:01 Fix test check
Hood Chatham eb244724 2021-07-16T14:33:04 Use CHECK to assert more things in test suite (#654) * Use CHECK to assert more things in test suite * Use snprintf instead of sprintf * Fix va_struct1 and va_struct3
Anthony Green 1ed0aa73 2021-06-28T18:45:11 Fix warnings
Anthony Green 0a2cc2ec 2021-06-28T14:59:07 Add missing test cases to distribution
Hood Chatham ee3ef737 2021-06-28T11:51:35 Add tests for single entry structs (#653)
Hood Chatham f08c5ace 2021-06-28T07:24:19 Fix the assertions in cls-24byte (#652) * Fix the assertions in cls-24byte * Update print statement too
Hood Chatham 9fa94c60 2021-06-27T11:02:33 Print more information when an assertion fails in test suite (#649)
Hood Chatham 91eaadfb 2021-06-27T09:49:31 Fix signature of function pointer in cls_dbls_struct (#648)
Anthony Green c0b210c7 2021-06-26T10:55:57 Remove test case
Matthew Green 87429ce7 2021-06-26T08:49:45 This test includes a closure and must live in the closures test directory. (#645) Co-authored-by: Matthew Green <squidhacks@users.noreply.github.com>
Hood Chatham 8d83c7c1 2021-06-25T19:50:33 Make test methods static (#644)
Anthony Green fa1ef887 2021-06-22T08:48:24 Avoid undefined behaviour
Jakub Jelinek 5651bea2 2021-06-15T15:19:26 2021-06-15 Jakub Jelinek <jakub@redhat.com> * src/x86/ffi64.c (classify_argument): For FFI_TYPE_STRUCT set words to number of words needed for type->size + byte_offset bytes rather than just type->size bytes. Compute pos before the loop and check total size of the structure. * testsuite/libffi.call/nested_struct12.c: New test.
Cheng Jin e6eb59cd 2021-06-09T16:00:10 Add struct test to verify a nested float struct (#640) The test aims to check a nested float struct [float, [float,float]] to see whether it works good with libffi. Signed-off-by: Cheng Jin <jincheng@ca.ibm.com>
Anthony Green 6eb38863 2021-06-09T15:45:31 Remove reference to old test case
Sergei Trofimovich 58dfdf6a 2021-03-24T23:19:54 testsuite: fix compiler vendor detection on dash as /bin/sh (#594) In https://bugs.gentoo.org/753299 Paolo Pedroni reported a single test failure out of all libffi. Here is the minimal reproducer: ``` $ ./autogen $ CONFIG_SHELL=/bin/dash ./configure --host=x86_64-pc-linux-gnu $ make check RUNTESTFLAGS='complex.exp' ... FAIL: libffi.complex/cls_align_complex_float.c (test for excess errors) ``` This happens because under 'dash' shell autoconf generates slightly different style of string quotation in `config.log`: - on bash: `ax_cv_c_compiler_vendor=gnu` - on dash: `ax_cv_c_compiler_vendor='gnu'` To avoid shell quotation parsing the change just embeds `compiler_vendor` into `local.exp` at configure time. Reported-by: Paolo Pedroni Bug: https://bugs.gentoo.org/753299 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Anthony Green 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.
Madhavan T. Venkataraman 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>
Jeremy Huddleston Sequoia 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>
Anthony Green 2e90bb55 2020-06-07T14:31:06 Add gcc bug tests back
Anthony Green 5dcb741f 2019-11-23T10:24:58 Move nested_struct3 test to closures directory
Anthony Green 1aca3330 2019-11-23T09:42:04 Add missing closing brace
Anthony Green c72b82f4 2019-11-23T08:48:53 Remove junk file from dist
Anthony Green 642d40ee 2019-11-23T07:49:58 Account for moved test files
Anthony Green 049da08a 2019-11-23T07:44:26 Add dejagnu directives accidentally removed
Anthony Green 36730f5d 2019-11-22T19:49:38 Move closure test to closure directory
Anthony Green c88c0e92 2019-11-22T19:27:34 More more closure tests to the closure test directory
Anthony Green 332a539e 2019-11-22T18:54:30 Move closure tests so we can easily XFAIL them for some targets
Anthony Green 1761a106 2019-11-22T18:53:09 Remove gccbug detection. GCC is good now.
Anthony Green 91a7fbe9 2019-11-20T07:16:41 Fix or1k lack-of-g++ checking in testsuite
Anthony Green bd3a4687 2019-11-19T17:14:23 No C++ for or1k-unknown-elf
Anthony Green d6e4f96b 2019-11-19T13:36:49 No C++ for or1k
Anthony Green 49701868 2019-11-19T10:07:16 Disable type warnings for or1k.
Anthony Green 262cf74f 2019-11-19T10:06:57 No c++ for or1k-elf
Anthony Green 188de63c 2019-11-07T12:03:19 Mark xfail for m68k and alpha.
Anthony Green 1d605944 2019-10-24T05:25:11 Add missing dist files.
Anthony Green 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.
pichikaudaykiran 09f9d856 2019-10-09T16:26:06 Making the change to correct the comment when SUN (#521) and GCC are used together
Anthony Green 042ef8c3 2019-02-12T08:50:30 Remove -Os testing. No ABI impact, and helps trim log lengths.
Anthony Green 8206253f 2018-05-09T10:50:46 Mark some cases as xfail due to GCC bug
hjl-tools 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.
Andreas Krebbel 801c1bd7 2018-04-05T14:27:32 Fix issue #421 (#422) Fantastic - thanks for digging into this.
Anthony Green 7b7638eb 2018-04-02T08:24:44 disable msabi testing for now
fwg 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
Anthony Green 48bdb028 2018-03-29T07:22:57 Trim some optimization tests
Anthony Green fa72b054 2018-03-29T07:10:23 Remove warning message from clang
Anthony Green 746c3ce2 2018-03-29T07:01:14 Expand ABI tests on x86. Testsuite bug fixes.
Anthony Green e8cf1338 2018-03-27T14:12:02 msvc c99 hack
Anthony Green a3e20940 2018-03-27T11:58:42 More msvc hacks
Anthony Green a82b456e 2018-03-27T11:49:46 msvc fixes
Anthony Green 85b6b209 2018-03-27T11:35:23 Force literals to float (msvc warning)
Anthony Green 5c2ca479 2018-03-27T04:01:37 Remove uninitialized warning. Fix #163.
Anthony Green 247e44b3 2018-03-18T07:01:54 Fix return values
Anthony Green 1f99701f 2018-03-17T22:49:58 Make tests compile/run standalone
Anthony Green a33bfa9b 2018-03-17T07:17:24 xfail unwind tests for moxie
Anthony Green d2f7e788 2018-03-14T09:06:38 Fix test cases with short results
Anthony Green 16313cb2 2018-03-13T08:52:30 Support compiler specific warning suppression flags
Anthony Green cca6d1fb 2018-03-13T08:51:34 Support compiler specific warning suppression flags
Anthony Green 9291f941 2018-03-13T08:37:21 Add bhaible's missing Makefile
Anthony Green bede01d8 2018-03-13T07:53:33 Remove stray directory
Anthony Green ddf7a8f7 2018-03-13T07:47:57 Update test list for dist
Anthony Green 6186261c 2018-03-12T21:53:18 Add Bruno Haible and Bill Triggs' libffi testsuite
Sergei Trofimovich 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>
Saleem Abdulrasool 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.
H.J. Lu 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.