Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
950 changes: 950 additions & 0 deletions deps/libffi/ChangeLog

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/libffi/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
libffi - Copyright (c) 1996-2025 Anthony Green, Red Hat, Inc and others.
libffi - Copyright (c) 1996-2026 Anthony Green, Red Hat, Inc and others.
See source files for details.

Permission is hereby granted, free of charge, to any person obtaining
Expand Down
26 changes: 25 additions & 1 deletion deps/libffi/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

libffi-3.6.0 was released on June 20, 2026.
libffi-3.7.1 was released on July 10, 2026.


What is libffi?
Expand Down Expand Up @@ -201,6 +201,30 @@ History

See the git log for details at http://github.com/libffi/libffi.

3.7.1 July-10-2026
Fix aarch64 ffi_call memory corruption when passing many large
structs by value.
Fix i386 thiscall/fastcall closure stack cleanup for 64-bit
integer and struct arguments.
Fix aarch64 int128 argument split between x7 and the stack on
Darwin (#993).
Fix aarch64 clang-cl link failure for HFA helper functions (#996).
Build a generic ffi_call_plan fallback on Windows x86-64.
Add Windows ARM64 (MSVC) build and continuous integration support.

3.7.0 July-7-2026
Add reusable call plans (ffi_call_plan_alloc/ffi_call_plan_invoke/ffi_call_plan_free).
Fix PA-RISC build broken by the conditional __int128 support added in 3.6.0.
Fix PA-RISC stack overflow passing many small structs by value.
Fix powerpc aix/darwin closure build errors (#987).
Include .note.GNU-stack on FreeBSD/x86 (#991).
Fix MSVC Win32 spin-lock atomics in bundled dlmalloc (#989).
Harden static trampoline and x86_64 closure internals.
Fix ffi_call clobbering the caller's argument pointer array
when passing large structs by value.
Allow a NULL rvalue in ffi_call to discard the return value.
Fix wasm widening of integral returns narrower than ffi_arg.

3.6.0 Jun-20-2026
Add LoongArch32 support.
Add RISC-V static trampoline support.
Expand Down
27 changes: 15 additions & 12 deletions deps/libffi/configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for libffi 3.6.0.
# Generated by GNU Autoconf 2.71 for libffi 3.7.1.
#
# Report bugs to <http://github.com/libffi/libffi/issues>.
#
Expand Down Expand Up @@ -621,8 +621,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libffi'
PACKAGE_TARNAME='libffi'
PACKAGE_VERSION='3.6.0'
PACKAGE_STRING='libffi 3.6.0'
PACKAGE_VERSION='3.7.1'
PACKAGE_STRING='libffi 3.7.1'
PACKAGE_BUGREPORT='http://github.com/libffi/libffi/issues'
PACKAGE_URL=''

Expand Down Expand Up @@ -1417,7 +1417,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libffi 3.6.0 to adapt to many kinds of systems.
\`configure' configures libffi 3.7.1 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1489,7 +1489,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libffi 3.6.0:";;
short | recursive ) echo "Configuration of libffi 3.7.1:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1628,7 +1628,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libffi configure 3.6.0
libffi configure 3.7.1
generated by GNU Autoconf 2.71

Copyright (C) 2021 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2259,7 +2259,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by libffi $as_me 3.6.0, which was
It was created by libffi $as_me 3.7.1, which was
generated by GNU Autoconf 2.71. Invocation command line was

$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -3233,8 +3233,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers fficonfig.h"


FFI_VERSION_STRING="3.5.2"
FFI_VERSION_NUMBER=30502
FFI_VERSION_STRING="3.7.1"
ffi_version_major=`echo "3.7.1" | cut -d. -f1`
ffi_version_minor=`echo "3.7.1" | cut -d. -f2 | sed 's/[^0-9].*//'`
ffi_version_micro=`echo "3.7.1" | cut -d. -f3 | sed 's/[^0-9].*//'`
FFI_VERSION_NUMBER=`expr ${ffi_version_major:-0} \* 10000 + ${ffi_version_minor:-0} \* 100 + ${ffi_version_micro:-0}`



Expand Down Expand Up @@ -3983,7 +3986,7 @@ fi

# Define the identity of the package.
PACKAGE='libffi'
VERSION='3.6.0'
VERSION='3.7.1'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -20658,7 +20661,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libffi $as_me 3.6.0, which was
This file was extended by libffi $as_me 3.7.1, which was
generated by GNU Autoconf 2.71. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -20726,7 +20729,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
libffi config.status 3.6.0
libffi config.status 3.7.1
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

Expand Down
12 changes: 9 additions & 3 deletions deps/libffi/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ dnl Process this with autoconf to create configure

AC_PREREQ([2.68])

AC_INIT([libffi],[3.6.0],[http://github.com/libffi/libffi/issues])
AC_INIT([libffi],[3.7.1],[http://github.com/libffi/libffi/issues])
AC_CONFIG_HEADERS([fficonfig.h])

FFI_VERSION_STRING="3.5.2"
FFI_VERSION_NUMBER=30502
dnl Derive the version macros from AC_INIT so they cannot drift when the
dnl release version is bumped. FFI_VERSION_NUMBER encodes X.Y.Z as
dnl X*10000 + Y*100 + Z, ignoring any non-numeric suffix (e.g. -rc0).
FFI_VERSION_STRING="AC_PACKAGE_VERSION"
ffi_version_major=`echo "AC_PACKAGE_VERSION" | cut -d. -f1`
ffi_version_minor=`echo "AC_PACKAGE_VERSION" | cut -d. -f2 | sed 's/[[^0-9]].*//'`
ffi_version_micro=`echo "AC_PACKAGE_VERSION" | cut -d. -f3 | sed 's/[[^0-9]].*//'`
FFI_VERSION_NUMBER=`expr ${ffi_version_major:-0} \* 10000 + ${ffi_version_minor:-0} \* 100 + ${ffi_version_micro:-0}`
AC_SUBST(FFI_VERSION_STRING)
AC_SUBST(FFI_VERSION_NUMBER)

Expand Down
122 changes: 87 additions & 35 deletions deps/libffi/doc/libffi.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This is libffi.info, produced by makeinfo version 7.1 from libffi.texi.
This manual is for libffi, a portable foreign function interface
library.

Copyright © 2008-2025 Anthony Green and Red Hat, Inc.
Copyright © 2008-2026 Anthony Green and Red Hat, Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -38,7 +38,7 @@ libffi
This manual is for libffi, a portable foreign function interface
library.

Copyright © 2008-2025 Anthony Green and Red Hat, Inc.
Copyright © 2008-2026 Anthony Green and Red Hat, Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -112,6 +112,7 @@ File: libffi.info, Node: Using libffi, Next: Memory Usage, Prev: Introduction
* Simple Example:: A simple example.
* Types:: libffi type descriptions.
* Multiple ABIs:: Different passing styles on one platform.
* Reusable Call Plans:: Building a call plan once and reusing it.
* The Closure API:: Writing a generic function.
* Closure Example:: A closure example.
* Thread Safety:: Thread safety.
Expand Down Expand Up @@ -200,6 +201,11 @@ function:
responsibility to ensure this. If CIF declares that the function
returns ‘void’ (using ‘ffi_type_void’), then RVALUE is ignored.

RVALUE may also be ‘NULL’, in which case the call is performed and
the return value is discarded. This works for any return type,
including structures returned in memory; ‘libffi’ supplies internal
scratch space for the callee when needed.

In most situations, ‘libffi’ will handle promotion according to the
ABI. However, for historical reasons, there is a special case with
return values that must be handled by your code. In particular,
Expand All @@ -213,7 +219,9 @@ function:
AVALUES is a vector of ‘void *’ pointers that point to the memory
locations holding the argument values for a call. If CIF declares
that the function has no arguments (i.e., NARGS was 0), then
AVALUES is ignored.
AVALUES is ignored. ‘ffi_call’ does not modify the vector or the
argument values it points to, so both may be reused for subsequent
calls.

Note that while the return value must be register-sized, arguments
should exactly match their declared type. For example, if an
Expand Down Expand Up @@ -739,7 +747,7 @@ compilers that support them:
type descriptors in the previous example.


File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, Up: Using libffi
File: libffi.info, Node: Multiple ABIs, Next: Reusable Call Plans, Prev: Types, Up: Using libffi

2.4 Multiple ABIs
=================
Expand All @@ -751,9 +759,46 @@ instance, the x86 platform has both ‘stdcall’ and ‘fastcall’ functions.
necessarily platform-specific.


File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Multiple ABIs, Up: Using libffi
File: libffi.info, Node: Reusable Call Plans, Next: The Closure API, Prev: Multiple ABIs, Up: Using libffi

2.5 Reusable Call Plans
=======================

When the same signature is called many times - as language bindings
typically do - you can build a “call plan” once and reuse it, so that
each call avoids the work ‘ffi_call’ would otherwise repeat on every
invocation. A plan is an opaque, caller-owned object built from a
prepared ‘ffi_cif’.

-- Function: ffi_call_plan * ffi_call_plan_alloc (ffi_cif *CIF)
Builds and returns a reusable plan for the signature described by
CIF, which must already have been prepared with ‘ffi_prep_cif’.
The plan does not copy CIF; CIF must remain valid for as long as
the plan is used.

Returns ‘NULL’ only when memory cannot be allocated. A signature
for which no accelerated path exists is still valid: the returned
plan simply falls back to ‘ffi_call’ when it is invoked.

-- Function: void ffi_call_plan_invoke (ffi_call_plan *PLAN, void *FN,
void *RVALUE, void **AVALUES)
Calls FN using PLAN. The FN, RVALUE, and AVALUES arguments have
exactly the same meaning as for ‘ffi_call’ (*note The Basics::),
including the rule that integral return values narrower than a
register are widened to ‘ffi_arg’.

A plan is immutable once built, so a single plan may be invoked
concurrently from multiple threads without additional locking.

-- Function: void ffi_call_plan_free (ffi_call_plan *PLAN)
Releases a plan returned by ‘ffi_call_plan_alloc’. Passing ‘NULL’
is harmless. The ‘ffi_cif’ the plan was built from is not
affected.


File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Reusable Call Plans, Up: Using libffi

2.5 The Closure API
2.6 The Closure API
===================

‘libffi’ also provides a way to write a generic function - a function
Expand Down Expand Up @@ -857,7 +902,7 @@ executable addresses.

File: libffi.info, Node: Closure Example, Next: Thread Safety, Prev: The Closure API, Up: Using libffi

2.6 Closure Example
2.7 Closure Example
===================

A trivial example that creates a new ‘puts’ by binding ‘fputs’ with
Expand Down Expand Up @@ -916,7 +961,7 @@ A trivial example that creates a new ‘puts’ by binding ‘fputs’ with

File: libffi.info, Node: Thread Safety, Prev: Closure Example, Up: Using libffi

2.7 Thread Safety
2.8 Thread Safety
=================

‘libffi’ is not completely thread-safe. However, many parts are, and if
Expand Down Expand Up @@ -1004,17 +1049,21 @@ Index
* cif: The Basics. (line 14)
* closure API: The Closure API. (line 13)
* closures: The Closure API. (line 13)
* const char *: The Basics. (line 106)
* const char *: The Basics. (line 113)
* FFI: Introduction. (line 31)
* ffi_call: The Basics. (line 72)
* ffi_call_plan *: Reusable Call Plans. (line 12)
* ffi_call_plan_alloc: Reusable Call Plans. (line 12)
* ffi_call_plan_free: Reusable Call Plans. (line 32)
* ffi_call_plan_invoke: Reusable Call Plans. (line 22)
* ffi_closure_alloc: The Closure API. (line 19)
* ffi_closure_free: The Closure API. (line 26)
* FFI_CLOSURES: The Closure API. (line 13)
* ffi_get_closure_size: The Basics. (line 118)
* ffi_get_default_abi: The Basics. (line 115)
* ffi_get_closure_size: The Basics. (line 125)
* ffi_get_default_abi: The Basics. (line 122)
* ffi_get_struct_offsets: Size and Alignment. (line 39)
* ffi_get_version: The Basics. (line 106)
* ffi_get_version_number: The Basics. (line 110)
* ffi_get_version: The Basics. (line 113)
* ffi_get_version_number: The Basics. (line 117)
* ffi_prep_cif: The Basics. (line 16)
* ffi_prep_cif_var: The Basics. (line 39)
* ffi_prep_closure_loc: The Closure API. (line 41)
Expand Down Expand Up @@ -1051,36 +1100,39 @@ Index
* ffi_type_ushort: Primitive Types. (line 53)
* ffi_type_void: Primitive Types. (line 10)
* Foreign Function Interface: Introduction. (line 31)
* size_t: The Basics. (line 118)
* unsigned int: The Basics. (line 115)
* unsigned long: The Basics. (line 110)
* size_t: The Basics. (line 125)
* unsigned int: The Basics. (line 122)
* unsigned long: The Basics. (line 117)
* void: The Basics. (line 72)
* void <1>: The Closure API. (line 19)
* void <2>: The Closure API. (line 26)
* void <1>: Reusable Call Plans. (line 22)
* void <2>: Reusable Call Plans. (line 32)
* void <3>: The Closure API. (line 19)
* void <4>: The Closure API. (line 26)



Tag Table:
Node: Top1387
Node: Introduction2909
Node: Using libffi4569
Node: The Basics5098
Node: Simple Example10868
Node: Types11925
Node: Primitive Types12436
Node: Structures14753
Node: Size and Alignment15864
Node: Arrays Unions Enums18135
Node: Type Example21112
Node: Complex22418
Node: Complex Type Example23932
Node: Multiple ABIs26984
Node: The Closure API27367
Node: Closure Example31703
Node: Thread Safety33347
Node: Memory Usage34180
Node: Missing Features35455
Node: Index35832
Node: The Basics5172
Node: Simple Example11346
Node: Types12403
Node: Primitive Types12914
Node: Structures15231
Node: Size and Alignment16342
Node: Arrays Unions Enums18613
Node: Type Example21590
Node: Complex22896
Node: Complex Type Example24410
Node: Multiple ABIs27462
Node: Reusable Call Plans27849
Node: The Closure API29566
Node: Closure Example33908
Node: Thread Safety35552
Node: Memory Usage36385
Node: Missing Features37660
Node: Index38037

End Tag Table

Expand Down
Binary file modified deps/libffi/doc/libffi.pdf
Binary file not shown.
Loading
Loading