platform/upstream/libffi.git
15 months agoUpdate sparc64 host
Anthony Green [Sun, 18 Feb 2024 13:41:04 +0000 (08:41 -0500)]
Update sparc64 host

15 months agoUpdate cfarm hostnames
Anthony Green [Sun, 18 Feb 2024 13:02:45 +0000 (08:02 -0500)]
Update cfarm hostnames

15 months agoAlways define long double types.
Anthony Green [Sun, 18 Feb 2024 12:48:51 +0000 (07:48 -0500)]
Always define long double types.

15 months agoUpdate
Anthony Green [Thu, 15 Feb 2024 13:35:02 +0000 (08:35 -0500)]
Update

15 months agoupdate copyright year in libffi.texi
Anthony Green [Thu, 15 Feb 2024 13:32:42 +0000 (08:32 -0500)]
update copyright year in libffi.texi

15 months agoUpdate version, copyright and testsuite info.
Anthony Green [Thu, 15 Feb 2024 13:30:09 +0000 (08:30 -0500)]
Update version, copyright and testsuite info.

15 months agoFix test filename reference
Anthony Green [Thu, 15 Feb 2024 13:03:21 +0000 (08:03 -0500)]
Fix test filename reference

15 months agodocs(README): update release details for libffi-3.4.5
Anthony Green [Thu, 15 Feb 2024 13:01:43 +0000 (08:01 -0500)]
docs(README): update release details for libffi-3.4.5

15 months agomips: Fix N32 ABI return value handling (#813)
Xi Ruoyao [Thu, 15 Feb 2024 12:52:13 +0000 (20:52 +0800)]
mips: Fix N32 ABI return value handling (#813)

In N32 ABI, 8-bit or 16-bit integers should be extended following the
signedness of the integer, but 32-bit integers should always be
sign-extended to 64-bit (note that N32 ABI only works on 64-bit CPUs).

So handling this in everything using libffi would be nasty.  And the
libffi code for architectures with a similar rule (LoongArch & RISC-V)
also properly handle this.  Let's do this work in libffi for MIPS N32
too.

This fixes two failures in Python 3.12.1 ctypes test.

15 months agoFix loongarch64 soft-float build (#816) (#817)
杨屿杰 [Thu, 15 Feb 2024 12:51:40 +0000 (20:51 +0800)]
Fix loongarch64 soft-float build (#816) (#817)

15 months agoEmscripten: Don't unbox single element structs if they are larger than 16 bytes ...
Hood Chatham [Thu, 15 Feb 2024 12:51:12 +0000 (04:51 -0800)]
Emscripten: Don't unbox single element structs if they are larger than 16 bytes (#818)

This arguably is a compensation for a Python ctypes bug / strange behavior
described here:
https://github.com/python/cpython/blob/a16a9f978f42b8a09297c1efbf33877f6388c403/Modules/_ctypes/stgdict.c#L718-L779

If a struct is larger than 16 bytes, Python does not bother to accurately report
its contents figuring that we don't need to know.

15 months agoaarch64: add BTI flag to ELF notes (#822)
Bill Roberts [Thu, 15 Feb 2024 12:50:40 +0000 (06:50 -0600)]
aarch64: add BTI flag to ELF notes (#822)

When a program is loaded and linked, the first ELF file that doesn't
declare that BTI is supported in the GNU NOTES section disables BTI
support.

Example:
readelf -n ./aarch64-unknown-linux-gnu/.libs/libffi.so
Displaying notes found in: .note.gnu.property
  Owner                Data size  Description
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: AArch64 feature: BTI

Fixes: #823
Signed-off-by: Bill Roberts <bill.roberts@arm.com>
15 months agodon't skip ffi_type_longdouble symbols (#814) (#824)
Dan Horák [Thu, 15 Feb 2024 12:50:13 +0000 (13:50 +0100)]
don't skip ffi_type_longdouble symbols (#814) (#824)

Seems there are configurations (ppc64 or ppc64le) that define
HAVE_LONG_DOUBLE_VARIANT in fficonfig.h, but do not define
HAVE_LONG_DOUBLE, and still want ffi_type_{,complex_}longdouble
symbols. Update the condition in libffi.map.in accordingly.

15 months agoLoongArch: Fix a build error with GCC 14 (#825)
Xi Ruoyao [Thu, 15 Feb 2024 12:49:27 +0000 (20:49 +0800)]
LoongArch: Fix a build error with GCC 14 (#825)

Fix the build error with GCC 14:

    ../src/loongarch64/ffi.c: In function 'ffi_prep_closure_loc':
    ../src/loongarch64/ffi.c:525:7: error: implicit declaration of
    function 'ffi_tramp_set_parms' [-Wimplicit-function-declaration]

16 months agoUpdate README.md (#820)
bartoli [Thu, 1 Feb 2024 03:54:57 +0000 (04:54 +0100)]
Update README.md (#820)

For cygwin/MSVC build, CXXCPP is also needed to pass configure checks

16 months ago`feat(github-actions): add new build workflow for warp`
Anthony Green [Thu, 1 Feb 2024 03:43:38 +0000 (22:43 -0500)]
`feat(github-actions): add new build workflow for warp`

17 months agoPut more optional symbols behind ifdefs (#812)
Chongyun Lee [Sun, 24 Dec 2023 15:38:32 +0000 (23:38 +0800)]
Put more optional symbols behind ifdefs (#812)

17 months agoFix a variety of warnings (#811)
Виктор Чернякин [Fri, 22 Dec 2023 10:30:50 +0000 (03:30 -0700)]
Fix a variety of warnings (#811)

17 months agoRemove warnings
Anthony Green [Thu, 21 Dec 2023 20:19:44 +0000 (15:19 -0500)]
Remove warnings

17 months agoEliminate warning
Anthony Green [Thu, 21 Dec 2023 19:04:19 +0000 (14:04 -0500)]
Eliminate warning

18 months agoaarch64: Write the BTI instructions as "hint" instructions (#810)
Martin Storsjö [Tue, 28 Nov 2023 22:38:13 +0000 (00:38 +0200)]
aarch64: Write the BTI instructions as "hint" instructions (#810)

GNU binutils refuses to assemble the direct BTI instructions unless
the target architecture explicitly supports BTI, ending up with errors
such as

    ../src/aarch64/sysv.S: Assembler messages:
    ../src/aarch64/sysv.S:87: Error: selected processor does not support `bti c'
    ../src/aarch64/sysv.S:156: Error: selected processor does not support `bti j'

Building with -march=armv8.5-a fixes building this.

However, the BTI instructions assemble into hint instructions, that
are ignored by processors that don't implement them. Therefore it is
possible to assemble them for the baseline armv8.0-a target as well,
by replacing "bti j" with "hint #36", "bti c" with "hint #34" and
"bti jc" with "hint #38"; this assembles into the same instruction
bits.

18 months agoReference recent changes
Anthony Green [Thu, 23 Nov 2023 14:22:20 +0000 (09:22 -0500)]
Reference recent changes

18 months agoFix visibility check for AIX (#804)
David Tenty [Thu, 23 Nov 2023 14:16:56 +0000 (09:16 -0500)]
Fix visibility check for AIX (#804)

18 months ago[powerpc][AIX] fix layout issues for nested struct types (#805)
David Tenty [Thu, 23 Nov 2023 14:16:35 +0000 (09:16 -0500)]
[powerpc][AIX] fix layout issues for nested struct types (#805)

* [powerpc][AIX] fix layout issues for nested struct types

On AIX under the default power alignment rules, the layout
of struct types which are nested inside other structs may
be different than the layout of those types on their own.

Specifically the first member double rules which would
apply an eight byte alignment if that type appears in the
first position of a struct:

 1) apply recursively if the struct appear in the first member
    of another struct
 2) do not apply if that struct is itself a member of another struct
    and not the first member.

The current implementation of the rules in libffi doesn't handle these
cases, causing a mismatch with the compiler and causing some crashes
we see when OpenJ9 is used with libffi on AIX.

This PR corrects this and adds some representative test cases.

* Fix code style

* Add a size check

* Add additional test

* Fix padding in internal structs

* Flip condition back to original form

* Add a comment

18 months agoAdd bti intructions to aarch64 assembly to work with strict (#808)
Tobias Heider [Thu, 23 Nov 2023 14:15:29 +0000 (15:15 +0100)]
Add bti intructions to aarch64 assembly to work with strict (#808)

BTI enforcement on OpenBSD.

19 months agoDisable firefox testing
Daily Price Depot Droid [Sat, 21 Oct 2023 13:58:28 +0000 (09:58 -0400)]
Disable firefox testing

19 months agoTry logging
Daily Price Depot Droid [Sat, 21 Oct 2023 13:05:48 +0000 (09:05 -0400)]
Try logging

19 months agoCheck if FFI_GO_CLOSURES is defined (#796)
Nobuyoshi Nakada [Sat, 21 Oct 2023 11:44:24 +0000 (20:44 +0900)]
Check if FFI_GO_CLOSURES is defined (#796)

This macro is always defined to 1 if defined, or undefined.
With `-Wundef` option, checking the value without checking if it is defined causes warnings:

```
/opt/local/include/ffi.h:477:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
#if FFI_GO_CLOSURES
    ^
```

19 months agoAdd support for Haikuos on PowerPC (#799)
Yn0ga [Sat, 21 Oct 2023 11:43:43 +0000 (13:43 +0200)]
Add support for Haikuos on PowerPC (#799)

19 months agoFix passing floating point arguments on 64bits SPARC (libffi#778) (#802)
Petr Sumbera [Sat, 21 Oct 2023 11:42:11 +0000 (13:42 +0200)]
Fix passing floating point arguments on 64bits SPARC (libffi#778) (#802)

19 months agoPut optional symbols behind ifdefs (#800)
Alfred Wingate [Fri, 20 Oct 2023 12:02:37 +0000 (15:02 +0300)]
Put optional symbols behind ifdefs (#800)

Signed-off-by: Alfred Wingate <parona@protonmail.com>
21 months agoFix build failures on HP-UX (#792)
Michael Osipov [Mon, 4 Sep 2023 11:27:01 +0000 (13:27 +0200)]
Fix build failures on HP-UX (#792)

This fixes #328

Co-authored-by: Chris Hunt <chrahunt@gmail.com>
21 months agoReplace use of triple with target, and explicitly specify build host to force cross...
Russell Keith-Magee [Mon, 4 Sep 2023 11:26:11 +0000 (19:26 +0800)]
Replace use of triple with target, and explicitly specify build host to force cross-compilation (#794)

21 months agoFix python and pyodide version
Anthony Green [Thu, 31 Aug 2023 20:31:42 +0000 (16:31 -0400)]
Fix python and pyodide version

21 months agoUpgrade pyodide version to match newer selenium API
Anthony Green [Thu, 31 Aug 2023 12:48:50 +0000 (08:48 -0400)]
Upgrade pyodide version to match newer selenium API

22 months agoMake label private on apple (#788)
Ivan Tadeu Ferreira Antunes Filho [Sat, 12 Aug 2023 13:02:39 +0000 (09:02 -0400)]
Make label private on apple (#788)

Private labels on apple must start with L prefix, while on ELF they start with .L prefix.
This makes the label start with L on apple instead of .L.

23 months agoEmscripten build: Remove -sSTRICT_JS (#781)
Hood Chatham [Wed, 21 Jun 2023 04:17:04 +0000 (21:17 -0700)]
Emscripten build: Remove -sSTRICT_JS (#781)

This rasies errors on newer versions of the emscripten compiler.

2 years agoMerge branch 'master' of github.com:/libffi/libffi
Anthony Green [Mon, 3 Apr 2023 12:20:32 +0000 (08:20 -0400)]
Merge branch 'master' of github.com:/libffi/libffi

2 years agoAdd tests with homogeneous aggregate types
Anthony Green [Mon, 3 Apr 2023 12:18:23 +0000 (08:18 -0400)]
Add tests with homogeneous aggregate types

2 years agoMore accurate explanation of wasm32 state in readme (#776)
Hood Chatham [Mon, 3 Apr 2023 02:54:22 +0000 (19:54 -0700)]
More accurate explanation of wasm32 state in readme (#776)

There are three main wasm32 target triples:
* wasm32-unknown-unknown
* wasm32-unknown-emscripten
* wasm32-unknown-wasi

The wasm32 port is only for the wasm32-unknown-emscripten target triple.
(The other triples have no dynamic linking support so libffi would be both
hard to port and of limited utility.)

2 years agoMention ARCv3 work
Anthony Green [Sat, 18 Feb 2023 01:35:44 +0000 (20:35 -0500)]
Mention ARCv3 work

2 years agoUpdate ARC's libffi port (#771)
Claudiu Zissulescu [Sat, 18 Feb 2023 01:33:47 +0000 (03:33 +0200)]
Update ARC's libffi port (#771)

* Add support for ARC and ARC64

Add support for ARC/ARC32/ARC64

* Implementation of GO Closure for ARC/ARC32/ARC64 Architectures

---------

Co-authored-by: Nuno Cardoso <cardoso@synopsys.com>
Co-authored-by: Luis Silva <luiss@synopsys.com>
2 years agoNormalize libffi labels
Anthony Green [Thu, 9 Feb 2023 17:23:35 +0000 (12:23 -0500)]
Normalize libffi labels

2 years agoUse rlgl
Anthony Green [Thu, 9 Feb 2023 15:31:22 +0000 (10:31 -0500)]
Use rlgl

2 years agoAdd emscripten gha workflow (#768)
Hood Chatham [Thu, 9 Feb 2023 14:01:37 +0000 (06:01 -0800)]
Add emscripten gha workflow (#768)

Resolves issue #767

2 years agoRename label
Anthony Green [Sun, 5 Feb 2023 14:51:37 +0000 (09:51 -0500)]
Rename label

2 years agoUse libffi-dg-prune to handle Emscripten INFO messages rather than patching emcc...
Hood Chatham [Thu, 2 Feb 2023 22:48:07 +0000 (14:48 -0800)]
Use libffi-dg-prune to handle Emscripten INFO messages rather than patching emcc.py (#766)

2 years agoMention wasm32
Anthony Green [Thu, 2 Feb 2023 21:09:14 +0000 (16:09 -0500)]
Mention wasm32

2 years agoModernize
Anthony Green [Thu, 2 Feb 2023 21:04:34 +0000 (16:04 -0500)]
Modernize

2 years agoAdd wasm32 emscripten support (#763)
Hood Chatham [Thu, 2 Feb 2023 17:10:00 +0000 (09:10 -0800)]
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>
2 years agoForward declare open_temp_exec_file (#764)
serge-sans-paille [Thu, 2 Feb 2023 14:46:29 +0000 (14:46 +0000)]
Forward declare open_temp_exec_file (#764)

It's defined in closures.c and used in tramp.c.
Also declare it as an hidden symbol, as it should be.

Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
2 years agoMention HPPA fixes
Anthony Green [Thu, 2 Feb 2023 12:06:02 +0000 (07:06 -0500)]
Mention HPPA fixes

2 years agoFrom Dave Anglin:
Anthony Green [Thu, 2 Feb 2023 12:04:55 +0000 (07:04 -0500)]
From Dave Anglin:

This patch is derived from the work done in implementing libffi for 64-bit hppa64-hpux target. Currently, the 32-bit hppa targets do a linear search for the return type of an ffi_call. This is slow and inefficient. A jump table can used to jump directly to the code used to process the return value. In most common cases, the return value can be processed in the jump table itself.

The patch also fixes return handling for FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16 and FFI_TYPE_SINT16.

2 years agoFrom Dave Anglin:
Anthony Green [Thu, 2 Feb 2023 12:02:53 +0000 (07:02 -0500)]
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.

2 years agoAdd HPPA64 support
Anthony Green [Thu, 2 Feb 2023 11:59:46 +0000 (06:59 -0500)]
Add HPPA64 support

2 years agolibffi: Fix X86 32b Darwin build and EH frames. (#757)
Iain Sandoe [Thu, 2 Feb 2023 11:44:13 +0000 (11:44 +0000)]
libffi: Fix X86 32b Darwin build and EH frames. (#757)

This addresses a number of issues in the X86 Darwin 32b port for libffi.

1. The pic symbol stubs are weak definitions; the correct section placement
   for these depends on the linker version in use.  We do not have access
   to that information, but we can use the target OS version (assumes that
   the user has installed the latest version of xcode available).
   When a coalesced section is in use (OS versions earlier than Darwin12 /
   OSX 10.8), its name must differ from  __TEXT,__text since otherwise that
   would correspond to altering the attributes of the .text section (which
   produces a diagnostic from the assembler).
   Here we use __TEXT, __textcoal_nt for this which is what GCC emits for
   these stubs.
   For later versions than Darwin 12 (OS X 10.8) we can place the stubs in
   the .text section (if we do not we get a diagnostic from clang -cc1as
   saying that the use of coalesced sections for this is deprecated).

2. The EH frame is specified manually, since there is no support for .cfi_
   directives in 'cctools' assemblers.  The implementation needs to provide
   offsets for CFA advance, code size and to the CIE as signed values
   rather than relocations. However the cctools assembler will produce a
   relocation for expressions like ' .long Lxx-Lyy' which then leads to a
   link-time error.  We correct this by forming the offset values using
   ' .set' directives and then assigning the results of them.

3. The register numbering used by m32 X86 Darwin EH frames is not the same
   as the DWARF debug numbering (the Frame and Stack pointer numbers are
   swapped).

4. The FDE address encoding used by the system tools is '0x10' (PCrel + abs)
   where the value provided was PCrel + sdata4.

5. GCC does not use compact unwind at present, and it was not implemented
   until Darwin10 / OSX 10.6.  There were some issues with function location
   in 10.6 so that the solution here suppresses emitting the compact unwind
   section until Darwin11 / OSX 10.7.

2 years agoDarwin: Search for both shared and convenience libraries in each path. (#761)
Iain Sandoe [Thu, 2 Feb 2023 11:42:46 +0000 (11:42 +0000)]
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.

2 years agoFix signed vs unsigned comparison (#765)
serge-sans-paille [Thu, 2 Feb 2023 11:40:17 +0000 (11:40 +0000)]
Fix signed vs unsigned comparison (#765)

As reported by -Wsign-compare. In the case of getting the result of
comparing the result of sysconf (_SC_PAGESIZE) to other value, this also
correctly handles edge cases where the above fails and returns -1.

Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
2 years agoUse checkout@v3, with nodejs 16
Anthony Green [Sun, 8 Jan 2023 14:01:00 +0000 (09:01 -0500)]
Use checkout@v3, with nodejs 16

2 years agofix typo (#758)
YongKang Zhou [Sun, 8 Jan 2023 13:56:34 +0000 (21:56 +0800)]
fix typo (#758)

`mingW` -> `MinGW`

2 years agoarm/sysv: reverted clang VFP mitigation (#747)
Alexander Kanavin [Mon, 5 Dec 2022 02:20:09 +0000 (03:20 +0100)]
arm/sysv: reverted clang VFP mitigation (#747)

Since commit e3d2812ce43940aacae5bab2d0e965278cb1e7ea,
seperate instructions were used when compiling under clang,
as clang didn't allow the directives at the time. This mitigation
now causes compilation to fail under clang 10, as described by
https://github.com/libffi/libffi/issues/607. Now that
clang supports the LDC and SDC instructions, this mitigation
has been reverted.

Co-authored-by: Brett Warren <brett.warren@arm.com>
2 years agoFix large struct passing on PA-RISC
Anthony Green [Sun, 20 Nov 2022 17:20:40 +0000 (12:20 -0500)]
Fix large struct passing on PA-RISC

2 years agoAdd missing test cases
Anthony Green [Tue, 25 Oct 2022 14:28:19 +0000 (10:28 -0400)]
Add missing test cases

2 years agoSmall build cleanup (#743)
Xavier Claessens [Mon, 24 Oct 2022 18:39:04 +0000 (20:39 +0200)]
Small build cleanup (#743)

* configure.ac: Remove some unused checks

* Fix FFI_API definition

When doing a static build dllimport/dllexport should be disabled. It was
also using 2 different macros FFI_BUILDING_DLL and FFI_BUILDING for no
reason.

2 years agoUpdate to version 3.4.4
Anthony Green [Mon, 24 Oct 2022 00:17:29 +0000 (20:17 -0400)]
Update to version 3.4.4

2 years agoMore aarch64 fixes
Anthony Green [Sun, 23 Oct 2022 15:25:10 +0000 (11:25 -0400)]
More aarch64 fixes

2 years agoFix types of temporary variables in aarch64 extend_integer_type (#745)
Icecream95 [Sun, 23 Oct 2022 15:08:10 +0000 (04:08 +1300)]
Fix types of temporary variables in aarch64 extend_integer_type (#745)

Fixes truncated values in weston-info output.

2 years agotypos (#742)
musvaage [Mon, 17 Oct 2022 22:26:17 +0000 (17:26 -0500)]
typos (#742)

2 years agoAdd 32-bit cygwin test
Anthony Green [Sun, 16 Oct 2022 16:41:56 +0000 (12:41 -0400)]
Add 32-bit cygwin test

2 years agoCorrection for older compilers
Anthony Green [Mon, 10 Oct 2022 18:32:35 +0000 (14:32 -0400)]
Correction for older compilers

2 years agoFlush output before aborting (#740)
Andreas Schwab [Mon, 10 Oct 2022 15:59:04 +0000 (17:59 +0200)]
Flush output before aborting (#740)

Co-authored-by: Andreas Schwab <schwab@suse.de>
2 years agoFix strict aliasing problem in aarch64 ffi_call (#739)
Andreas Schwab [Mon, 10 Oct 2022 15:58:48 +0000 (17:58 +0200)]
Fix strict aliasing problem in aarch64 ffi_call (#739)

The assignment a = &dest in ffi_call_int may be moved after the call to
extend_integer_type because that function accesses the assigned value with
a different type.

Co-authored-by: Andreas Schwab <schwab@suse.de>
2 years agoriscv: make copies of structs passed by reference (#738)
Andreas Schwab [Mon, 10 Oct 2022 15:57:47 +0000 (17:57 +0200)]
riscv: make copies of structs passed by reference (#738)

Co-authored-by: Andreas Schwab <schwab@suse.de>
2 years agoAdd gcc-12 testing for aarch64 linux
Anthony Green [Sat, 8 Oct 2022 22:35:38 +0000 (18:35 -0400)]
Add gcc-12 testing for aarch64 linux

2 years agoTweak quotes
Anthony Green [Sun, 2 Oct 2022 17:03:37 +0000 (13:03 -0400)]
Tweak quotes

2 years agoAdd .
Anthony Green [Wed, 28 Sep 2022 14:16:45 +0000 (10:16 -0400)]
Add .

2 years agoUpdate README for 3.4.4.
Anthony Green [Wed, 28 Sep 2022 14:16:01 +0000 (10:16 -0400)]
Update README for 3.4.4.

2 years agoRevert to previous cfi check. (#735)
Anthony Green [Wed, 28 Sep 2022 13:05:45 +0000 (09:05 -0400)]
Revert to previous cfi check. (#735)

2 years agoRemove nested comments
Anthony Green [Wed, 28 Sep 2022 02:05:42 +0000 (22:05 -0400)]
Remove nested comments

2 years agoDon't tweak path
Anthony Green [Wed, 28 Sep 2022 01:25:30 +0000 (21:25 -0400)]
Don't tweak path

2 years agoFix find
Anthony Green [Wed, 28 Sep 2022 01:05:26 +0000 (21:05 -0400)]
Fix find

2 years agoLocate tools
Anthony Green [Wed, 28 Sep 2022 00:29:17 +0000 (20:29 -0400)]
Locate tools

2 years agoUse cross tools for Windows
Anthony Green [Wed, 28 Sep 2022 00:13:42 +0000 (20:13 -0400)]
Use cross tools for Windows

2 years agoFix shell
Anthony Green [Tue, 27 Sep 2022 22:23:06 +0000 (18:23 -0400)]
Fix shell

2 years agoFind ms tools
Anthony Green [Tue, 27 Sep 2022 21:58:31 +0000 (17:58 -0400)]
Find ms tools

2 years ago32- and 64-bit Windows
Anthony Green [Tue, 27 Sep 2022 21:39:44 +0000 (17:39 -0400)]
32- and 64-bit Windows

2 years agoAdd "lto" to triple to identify lto builds
Anthony Green [Tue, 27 Sep 2022 12:13:17 +0000 (08:13 -0400)]
Add "lto" to triple to identify lto builds

2 years agoTry aarch64 linux with -flto
Anthony Green [Tue, 27 Sep 2022 11:57:37 +0000 (07:57 -0400)]
Try aarch64 linux with -flto

2 years agoShow compiler version
Anthony Green [Mon, 26 Sep 2022 20:45:00 +0000 (16:45 -0400)]
Show compiler version

2 years agoNever link pthread for android
Anthony Green [Mon, 26 Sep 2022 15:41:48 +0000 (11:41 -0400)]
Never link pthread for android

2 years agoCI: add Android builds (#732)
Frederik Seiffert [Mon, 26 Sep 2022 11:43:40 +0000 (13:43 +0200)]
CI: add Android builds (#732)

2 years agoTest idea borrowed from cpython
Anthony Green [Sun, 25 Sep 2022 02:03:52 +0000 (22:03 -0400)]
Test idea borrowed from cpython

2 years agoor1k: All struct args are passed in memory
Anthony Green [Sun, 25 Sep 2022 01:41:02 +0000 (21:41 -0400)]
or1k: All struct args are passed in memory

2 years agomoxie: All struct args are passed in memory
Anthony Green [Sun, 25 Sep 2022 01:38:57 +0000 (21:38 -0400)]
moxie: All struct args are passed in memory

2 years agoAdd test case transcribed from cpython
Anthony Green [Sat, 24 Sep 2022 21:11:30 +0000 (17:11 -0400)]
Add test case transcribed from cpython

2 years agoSet host triplet for native builds
Anthony Green [Mon, 19 Sep 2022 23:42:35 +0000 (19:42 -0400)]
Set host triplet for native builds

2 years agoUpdate job names
Anthony Green [Mon, 19 Sep 2022 23:25:09 +0000 (19:25 -0400)]
Update job names

2 years agoGive better names to CI workflows
Anthony Green [Mon, 19 Sep 2022 22:23:42 +0000 (18:23 -0400)]
Give better names to CI workflows

2 years agoUpdate version to 3.4.4-experimental
Anthony Green [Mon, 19 Sep 2022 21:30:51 +0000 (17:30 -0400)]
Update version to 3.4.4-experimental

2 years agoSuppress error console output duing configure in case not an ELF file (#729)
Hans [Mon, 19 Sep 2022 21:26:59 +0000 (23:26 +0200)]
Suppress error console output duing configure in case not an ELF file (#729)

On Cygwin, MSYS and MinGW readelf is available, but files generated are no
ELF files. This results in an Error output on console:
'checking whether .eh_frame section should be read-only... readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
yes'
With this patch the error output is suppressed resulting in only
'checking whether .eh_frame section should be read-only... yes'
Setting of related variables is not changed.

Co-authored-by: Hannes Müller <>