|
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>
|
|
baa6bbbc
|
2023-02-02T06:59:46
|
|
Add HPPA64 support
|
|
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 <>
|
|
80912f2f
|
2022-09-01T14:47:16
|
|
Makefile: enable target overridings. (#661)
This patch allows target to provide extra files enabling the
override of Makefile rules.
This patch is not needed for libffi itself but only for GCC on AIX. The
t-aix file which is here empty will be replaced in GCC repository. We cannot
include GCC version directly here because it has no sense for a standalone
libffi.
Co-authored-by: Clement <clement.chigot@atos.net>
|
|
f259a6f6
|
2022-05-25T09:31:08
|
|
Support loongarch64 (#678)
* update config.{guess,sub}
* Support loongarch64
Co-Authored-By: Cheng Lulu <chenglulu@loongson.cn>
Co-Authored-By: Xi Ruoyao <xry111@mengyan1223.wang>
Co-Authored-By: Xu Hao
Co-Authored-By: Zhang Wenlong <zhangwenlong@loongson.cn>
Co-Authored-By: Pan Xuefeng <panxuefeng@loongson.cn>
Co-authored-by: panxuefeng <panxuefeng@loongson.cn>
Co-authored-by: Cheng Lulu <chenglulu@loongson.cn>
Co-authored-by: Xi Ruoyao <xry111@mengyan1223.wang>
|
|
dd5bd030
|
2021-04-07T05:42:10
|
|
Fix building for arm windows with mingw toolchains (#631)
* arm: Check _WIN32 instead of _M_ARM or _MSC_VER for detecting windows
This matches what was done for ARM64 in
c06468fa6674d3783a0edb1d0fae9afc8bc28513.
* arm: Only use armasm source when building with MSVC
When building for windows/arm with clang, the normal gas style .S
source works fine (if fixed up to support thumb and other windows
specifics).
This matches what was done for ARM64 in
c06468fa6674d3783a0edb1d0fae9afc8bc28513.
* arm: Fix sysv.S to work in thumb mode
Align cases in jump tables (adding nop padding to make sure each
case starts where expected).
Rewrite instructions that add directly to the pc register.
For ffi_closure_ret, factor out a call_epilogue subroutine that
restores both sp and pc from the stack; the thumb version of ldm
can't load into the sp register. To avoid excessive ifdeffing, keep
using call_epilogue in arm mode, but keep the shorter "ldm sp, {sp, pc}"
epilogue in that case.
* arm: Add win32 version of trampoline to sysv.S
This matches the version of it in sysv_msvc_arm32.S. The calling
C code expects a specific form of the trampoline on windows; make
sure these work the same on windows regardless of the form of
assembly used.
* arm: Avoid optimizing out clearing the thumb bit of ffi_arm_trampoline
We clear the thumb bit of ffi_arm_trampoline with a bitmask before
memcpying its instructions into closure->tramp.
If the bit isn't cleared, the memcpy of the trampoline function
copies the wrong instructions.
If the ffi_arm_trampoline symbol is declared as an array of int,
the compiler can assume that it is aligned to a 4 byte boundary
and the bitmask operation is a no-op, and optimize it out.
See https://godbolt.org/z/dE3jE1WTz; both Clang and GCC optimize
out the bitmask as it is, while MSVC doesn't. By declaring the
trampoline as an array of unsigned char, the bitmask works as
intended.
|
|
cb847436
|
2020-12-02T12:52:12
|
|
libffi/x86: Always check __x86_64__ for x32 hosts (#601) (#602)
Since for x86_64-*x32 and x86_64-x32-* hosts, -m32 generates ia32 codes.
We should always check __x86_64__ for x32 hosts.
|
|
8111cd06
|
2020-10-27T09:07:38
|
|
Add support for powerpc64le-*-freebsd*. (#581)
Tests pass with no additional changes needed, tested on hardware.
|
|
8276f812
|
2020-08-07T21:05:23
|
|
Upstream local FreeBSD patches (#567)
* Add support for FreeBSD mips
Add support for FreeBSD mips, this has been a local patch in the FreeBSD
ports tree for quite some time.
Originally submitted by sson, and committed by sbruno AT FreeBSD DOT org
See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191909 for
background details.
Signed-off-by: Niclas Zeising <zeising@daemonic.se>
* Add support for FreeBSD powerpcspe
Add support for powerpcspe on FreeBSD
This has been in the FreeBSD ports tree for some time.
Originally submitted by jhibbits AT FreeBSD DOT org.
Signed-off-by: Niclas Zeising <zeising@daemonic.se>
* Fix abort() on FreeBSD arm related to __clear_cache()
This patch has been in the FreeBSD ports tree for a number of years.
Original commit by koobs AT FreeBSD DOT org
Original commit message:
> devel/libffi: Fix abort() on ARM related to __clear_cache()
>
> The current FreeBSD/ARM __clear_cache() implementation does nothing #if
> __i386__ || __x86_64__ #else abort();
>
> cognet@ advises this is an issue for anything !Apple that is using the
> libcompiler_rt provided by Clang on ARM, and requires upstreaming.
See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=149167 for some
background details.
Signed-off-by: Niclas Zeising <zeising@daemonic.se>
|
|
fbd1de85
|
2020-06-29T08:02:20
|
|
Add support for csky
|
|
5e6ca054
|
2020-05-01T13:59:11
|
|
Add support for Kalray KVX architecture (#559)
|
|
c06468fa
|
2020-04-26T04:58:33
|
|
Fix building for aarch64 windows with mingw toolchains (#555)
* aarch64: Check _WIN32 instead of _M_ARM64 for detecting windows
This fixes building for aarch64 with mingw toolchains. _M_ARM64 is
predefined by MSVC, while mingw compilers predefine __aarch64__.
In aarch64 specific code, change checks for _M_ARM64 into checks for
_WIN32.
In arch independent code, check for
(defined(_M_ARM64) || defined(__aarch64__)) && defined(_WIN32)
instead of just _M_ARM64.
In src/closures.c, coalesce checks like
defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64)
into plain defined(_WIN32). Technically, this enables code for
ARM32 windows where it wasn't, but as far as I can see it, those
codepaths should be fine for that architecture variant as well.
* aarch64: Only use armasm source when building with MSVC
When building for windows/arm64 with clang, the normal gas style .S
source works fine. sysv.S and win64_armasm.S seem to be functionally
equivalent, with only differences being due to assembler syntax.
|
|
43887a91
|
2019-11-28T17:44:51
|
|
Add powerpc-eabi
|
|
247a5e78
|
2019-11-22T20:17:58
|
|
Capture x86-windows host like x86_64-windows (#529)
|
|
bbea6394
|
2019-11-18T13:06:26
|
|
Capture more or1k hosts
|
|
c2a68590
|
2019-08-07T11:57:45
|
|
fix mingw build and crashing bugs for Python Windows ARM64 (#496)
* fix mingw build and crashing bugs for Python Windows ARM64
* Fix issues found in PR review
|
|
db5706ff
|
2019-04-26T04:58:58
|
|
add support for 32-bit ARM on Windows (#477)
* add support for 32-bit ARM on Windows
* fix mismatched brace in appveyor.yml
* remove arm platform from appveyor.yml for now
* fix arm build
* fix typo
* fix assembler names
* try Visual Studio 2017
* add windows arm32 to .appveyor.yml
* update README.md
|
|
e1118af5
|
2019-02-19T03:58:25
|
|
changes for win32 on windows (#468)
|
|
3840d49a
|
2018-03-11T05:55:15
|
|
New RISC-V port (#281)
* Add RISC-V support
This patch adds support for the RISC-V architecture (https://riscv.org).
This patch has been tested using QEMU user-mode emulation and GCC 7.2.0
in the following configurations:
* -march=rv32imac -mabi=ilp32
* -march=rv32g -mabi=ilp32d
* -march=rv64imac -mabi=lp64
* -march=rv64g -mabi=lp64d
The ABI currently can be found at
https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md .
* Add RISC-V to README
* RISC-V: fix configure.host
|
|
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.
|
|
50e408ce
|
2017-05-21T20:44:10
|
|
add i?86-*-ios -- the iOS simulator (32bit)
|
|
a08cabe6
|
2017-05-21T20:25:16
|
|
add x86_64-*-ios -- the iOS simulator
|
|
69963d39
|
2017-03-19T07:33:39
|
|
We don't support 32-bit builds with the Microsoft toolchain
|
|
a0b14eea
|
2017-03-17T09:20:40
|
|
Merge pull request #291 from ramon-garcia/visual-studio-build
Build with Visual C++ (64 bits)
|
|
41185b56
|
2017-03-15T12:50:41
|
|
detect other x32 hosts
primarily x86_64-pc-linux-muslx32
while at it, add x86_64-x32-pc-linux-{gnu,musl} as well
|
|
1e0d107b
|
2017-01-08T20:12:59
|
|
Modify configure.host to detect compilation with Microsoft Visual C++ and use assembly with Intel syntax in that case
|
|
1f6b5a91
|
2015-07-26T16:27:34
|
|
Support the WIN64/EFI64 calling convention on all X86_64 platforms
Add a new calling convention FFI_EFI64, alias FFI_WIN64, on all X86_64
platforms. This allows libffi compiled on a 64-bit x86 platform to call
EFI functions.
Compile in ffiw64.c and win64.S on all X86_64 platforms. When compiled
for a platform other than X86_WIN64, ffiw64.c suffixes its functions
with _efi64, to avoid conflict with the platform's actual
implementations of those functions.
|
|
6c535775
|
2015-01-29T12:32:28
|
|
Handle NetBSD/powerpc the same as FreeBSD and OpenBSD.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
|
|
e46842b4
|
2015-01-13T07:23:48
|
|
Remove extra brackets in configure.host
This table is no longer in configure.ac, needing
protection from m4.
|
|
9f112619
|
2014-11-22T20:02:43
|
|
x86: Best guess at update for Darwin
|
|
5d69d57a
|
2014-11-13T13:50:39
|
|
configure: Move target source selection into configure.host
This eliminates the AM_CONDITIONAL ugliness, which eliminates
just a bit of extra boilerplate for a new target.
At the same time, properly categorize the EXTRA_DIST files
into SOURCES and HEADERS, for the generation of ctags.
|
|
57f52484
|
2014-11-13T12:42:54
|
|
configure: Split out configure.host
Split out the host case statement to a separate file, so that
we don't have to regenerate configure.in for changes therein.
|
|
a86bd318
|
2014-03-16T06:58:59
|
|
Merge configure.host into configure.ac
configure.host only has a single entry, and shows no signs of needing
more added.
|
|
c6dddbd0
|
2009-10-04T08:11:33
|
|
Initial commit
|