commit f9ea41683444ebe11cfa45b05223899764df28fb
Author: Anthony Green <green@moxielogic.com>
Date:   Mon Jun 28 21:10:49 2021 -0400

    Update version to 3.4.2

commit 2bdc8e52efb78d939f23efb4f9c515355610bff5
Author: Anthony Green <green@moxielogic.com>
Date:   Mon Jun 28 19:50:29 2021 -0400

    Version 3.4.1

commit c1d09bf08c2859abb40c476c57ae521d208f92a8
Author: Anthony Green <green@moxielogic.com>
Date:   Mon Jun 28 18:50:31 2021 -0400

    Update version to 3.4.0

commit 1ed0aa73806872f0c31dccf2c689c762239d3353
Author: Anthony Green <green@moxielogic.com>
Date:   Mon Jun 28 18:45:11 2021 -0400

    Fix warnings

commit 0a2cc2ec2893821f62b36b269da1dbc0442a5617
Author: Anthony Green <green@moxielogic.com>
Date:   Mon Jun 28 14:59:07 2021 -0400

    Add missing test cases to distribution

commit ee3ef737857e13cc01a15dbef298478d90188805
Author: Hood Chatham <hood@mit.edu>
Date:   Mon Jun 28 11:51:35 2021 -0700

    Add tests for single entry structs (#653)

commit f08c5ace5750f1e1f234f52f4d3d772bb8d276a0
Author: Hood Chatham <hood@mit.edu>
Date:   Mon Jun 28 07:24:19 2021 -0700

    Fix the assertions in cls-24byte (#652)
    
    * Fix the assertions in cls-24byte
    
    * Update print statement too

commit 4557f232926353f5cdec0f2f459e4d59ce8f19e4
Author: Anthony Green <green@moxielogic.com>
Date:   Mon Jun 28 09:53:01 2021 -0400

    3.4.0 release candidate 2

commit cd4428911d5c4d25ce2c24e6728124792124bba2
Author: Jeremy Huddleston Sequoia <jeremyhu@users.noreply.github.com>
Date:   Mon Jun 28 04:56:30 2021 -0700

    Add missing FFI_HIDDEN to ffi_tramp_is_present declaration (#651)
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

commit 9fa94c607852081adce33547bde292fe4313cff7
Author: Hood Chatham <hood@mit.edu>
Date:   Sun Jun 27 11:02:33 2021 -0700

    Print more information when an assertion fails in test suite (#649)

commit 91eaadfb2e4b79d12a45d24002b06563e5905e5d
Author: Hood Chatham <hood@mit.edu>
Date:   Sun Jun 27 09:49:31 2021 -0700

    Fix signature of function pointer in cls_dbls_struct (#648)

commit 132699b95d3ee4d889ea2a80540acf3300987dad
Author: Sergei Trofimovich <slyfox@gentoo.org>
Date:   Sun Jun 27 16:50:20 2021 +0100

    configure.ac: add --disable-exec-static-tramp flag (#647)
    
    Some projects like GHC (Glasgow Haskell Compiler) and
    gobject-introspection use `ffi_closure_alloc()` as a way
    to allocate executable memory. exec static tramp
    interferes with it (unclear how exactly yet).
    
    GHC symptom: ffi closure freeing cimplains about unexpected
    trampoline (GHC manually fills one):
    
    ```
    $ ghci
    GHCi, version 8.10.5: https://www.haskell.org/ghc/  :? for help
    ghc: freeHaskellFunctionPtr: not for me, guv! 0x7f0417a1efe8
    ghc: freeHaskellFunctionPtr: not for me, guv! 0x7f0417a1efc8
    ```
    
    gobject-introspection symptom:
    
    ```
    $ meld
    Segmentation fault (core dumped)
    
    $ gdb --args /usr/bin/python3.9 /usr/bin/meld
    (gdb) run
    ...
    Thread 1 "python3.9" received signal SIGSEGV, Segmentation fault.
    0x00007fffe9ac1ae8 in g_callable_info_free_closure (
      callable_info=0x555555d45990, closure=0x7fffe9e70c20)
        at ../gobject-introspection-1.68.0/girepository/girffi.c:428
    428       g_free (wrapper->ffi_closure.cif->arg_types);
    (gdb) bt
      callable_info=0x555555d45990, closure=0x7fffe9e70c20)
        at ../gobject-introspection-1.68.0/girepository/girffi.c:428
      data=0x555555d252d0)
        at ../pygobject-3.40.1/gi/pygi-closure.c:635
    ...
    ```
    
    To ease downstreams narrowing down the actual problem let's
    provide a knob to disable exec static trampolines.
    
    The change for not affect current default.
    
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

commit 4e07374c2773711902ec12905d5c64d95d22d050
Author: Anthony Green <green@moxielogic.com>
Date:   Sun Jun 27 11:25:06 2021 -0400

    Remove caveat about varargs support

commit 11f9713887e1d8e9bdf861c1555de55aba9fc46c
Author: Anthony Green <green@moxielogic.com>
Date:   Sun Jun 27 07:46:12 2021 -0400

    Update contact info

commit f792adb61a27aa2a7d24573b956ce29ebdb82e03
Author: Sergei Trofimovich <slyfox@gentoo.org>
Date:   Sat Jun 26 22:26:52 2021 +0100

    configure.ac: allow user to specify READELF (#646)
    
    Before the change with x86_64-pc-linux-gnu cross-compiler
    installed the configure was not able to find cross-readelf:
    
    ```
    $ ./configure --host=x86_64-pc-linux-gnu
    ...
    checking whether .eh_frame section should be read-only... .././configure: line 19540: readelf: command not found
    yes
    ...
    ```
    
    The change uses AC_CHECK_TOOL to automatically seatch for ${host}-readelf,
    readelf. And as a bonus it also allows user to override readelf with
    something like READELF=llvm-readelf.
    
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

commit 9cf15b3a284d8e79f3673b8743d4157739df5d36
Author: Anthony Green <green@moxielogic.com>
Date:   Sat Jun 26 12:12:06 2021 -0400

    Make 3.4 release candidate 1

commit 1e5dc8de825d03f5493884a45e1edeacda2106c5
Author: Anthony Green <green@moxielogic.com>
Date:   Sat Jun 26 12:08:35 2021 -0400

    Add missing file from make dist.  Add missing license info.

commit c0b210c7fd1e5b4a17e9fc839a4cf1d75483d591
Author: Anthony Green <green@moxielogic.com>
Date:   Sat Jun 26 10:55:57 2021 -0400

    Remove test case

commit 87429ce726ead7bb789d194c6d979c5b0c4086e9
Author: Matthew Green <85970515+squidhacks@users.noreply.github.com>
Date:   Sat Jun 26 08:49:45 2021 -0400

    This test includes a closure and must live in the closures test directory. (#645)
    
    Co-authored-by: Matthew Green <squidhacks@users.noreply.github.com>

commit 8d83c7c1fa331b93e58967979c59c38600df1ee9
Author: Hood Chatham <roberthoodchatham@gmail.com>
Date:   Fri Jun 25 19:50:33 2021 -0700

    Make test methods static (#644)

commit becae7397873d6bb85a271b16961f055e71f42a6
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Jun 22 13:01:06 2021 -0400

    Switch from travis-ci.org to travis-ci.com.

commit fa1ef887d4dc5d18696517e32e2ae98310f0040d
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Jun 22 08:48:24 2021 -0400

    Avoid undefined behaviour

commit 84bb56914756845371be62e2753041521fd5d261
Author: Tres Finocchiaro <tres.finocchiaro@gmail.com>
Date:   Tue Jun 22 07:33:46 2021 -0400

    Remove libtool-ldflags file from .gitignore (#600)
    
    This is correct.  Thank you!

commit 5651bea284ad0822eafe768e3443c2f4d7da2c8f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jun 15 15:19:26 2021 -0400

    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.

commit f56eb85227bbcc7bd81232a338655146385a77ca
Author: DJ Delorie <dj@delorie.com>
Date:   Tue Jun 15 08:50:20 2021 -0400

    Don't stop test on copy failure (#636)
    
    * Don't stop test on copy failure
    
    Static-library tests were failing only because there were
    no DLLs to copy.  This change makes a copy failure not stop
    the build; if a failed copy would otherwise be relevent, the
    later tests would fail anyway.
    
    While there are more clever ways to solve this, a brute force
    fix is sufficient.
    
    * [TEST] Try cygwin64; install more packages explicitly
    
    * use correct cygwin64 directory name
    
    appveyor has cygwin64 pre-installed in /cygwin64, and 32-bit cygwin
    in /cygwin
    
    * More testing - revert VS change, bump travis timeout
    
    * Add -g to update the rest of perl
    
    * Skip execution tests on non-native platforms
    
    Special site.exp that skips the unix_load() command for arm platforms.
    
    Unset TERM to avoid cruft in stdout
    
    Try harder to find the libffi libraries

commit ff059dd96af6ba4daf7bc9ddf22d1d2dbf6a177b
Author: vhankala <81743325+vhankala@users.noreply.github.com>
Date:   Thu Jun 10 18:41:02 2021 +0000

    Fix build on OpenBSD/mips64 (#638)
    
    The build fails on OpenBSD/mips64 because clang 11's integrated
    assembler expects read-only .eh_frame:
    
    ../src/mips/n32.S:585:9: error: changed section flags for .eh_frame, expected: 0x2
            .section .eh_frame,"aw",@progbits
            ^
    
    Use EH_FRAME_FLAGS to get matching flags for the section.

commit e6eb59cde6580607544160f8e7dedc326b4799fd
Author: Cheng Jin <jincheng@ca.ibm.com>
Date:   Wed Jun 9 16:00:10 2021 -0400

    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>

commit 6eb38863bc0b21854959ebf845f8672c44a99684
Author: Anthony Green <green@moxielogic.com>
Date:   Wed Jun 9 15:45:31 2021 -0400

    Remove reference to old test case

commit ca2235ecfe717ecaed6abbef3a2ca2918a91c60b
Author: Anthony Green <green@moxielogic.com>
Date:   Fri Jun 4 18:20:24 2021 -0400

    Revert appveyor changes

commit 243004cc4c8be552503a5d10710ebb252b406064
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Jun 1 23:00:29 2021 -0400

    Update vs version

commit 04c157f49a1b83798c102f3259bc397b9b7f7266
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Jun 1 22:57:47 2021 -0400

    Upgrade to vs2019

commit 03a78e88402fff424426a1968e014be93666b86f
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Jun 1 22:53:44 2021 -0400

    Try updating automake

commit 1f1829bd4ce19b58d0354db3bef21cb8402cdf82
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Jun 1 22:34:37 2021 -0400

    Bring in the latest version of perl

commit dd5bd03075149d7cf8441875c1a344e8beb57dde
Author: Martin Storsjö <martin@martin.st>
Date:   Wed Apr 7 05:42:10 2021 +0300

    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.

commit 95ef857d5c6ed15c6c6ba5f8a5b26c0a38b417ab
Author: Anthony Green <green@moxielogic.com>
Date:   Thu Mar 25 10:43:05 2021 -0400

    Verbose brew update.

commit 78c97c9ff4491e14e78992ffabdd043674c05e15
Author: Anthony Green <green@moxielogic.com>
Date:   Thu Mar 25 09:15:37 2021 -0400

    Move container images to quay.io.

commit 58dfdf6a84b98296ceb2b8b4237d37aa75bb2cd4
Author: Sergei Trofimovich <slyfox@gentoo.org>
Date:   Wed Mar 24 23:19:54 2021 +0000

    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>

commit eafab2356e8dcf5f01d2bcfa311cafba3b395a7e
Author: Jeremy Huddleston Sequoia <jeremyhu@users.noreply.github.com>
Date:   Wed Mar 24 11:38:36 2021 -0700

    arm64e: Pull in pointer authentication code from Apple's arm64e libffi port (#565)
    
    NOTES: This changes the ptrauth support from #548 to match what Apple is
           shipping in its libffi-27 tag.
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

commit 01b56f4b3e89a349228c4ccf55061d847153c8d6
Author: ericLemanissier <ericLemanissier@users.noreply.github.com>
Date:   Wed Mar 24 12:20:27 2021 +0100

    fix windows tests (#595)
    
    * Update .appveyor.yml
    
    * add (debug+release)*(shared+static) CI
    
    * fix libversion

commit 1aeb26714ec30649f5d9de5b4884a4ac46f5f474
Author: Ole André Vadla Ravnås <oleavr@gmail.com>
Date:   Wed Mar 24 12:16:12 2021 +0100

    x86: Fix thiscall and fastcall stack cleanup behavior (#611)
    
    These are meant to use callee clean-up.

commit e92c81a549924c80d70666ecbe5ed0c2fcd7963a
Author: Anthony Green <green@moxielogic.com>
Date:   Wed Mar 24 07:07:53 2021 -0400

    Mention MSVC runtime stack checking improvement

commit f88add14e40de398706c732e578620e8106062c7
Author: Ole André Vadla Ravnås <oleavr@gmail.com>
Date:   Wed Mar 24 12:04:51 2021 +0100

    x86: Fix MSVC runtime checks interop (#612)
    
    MSVC can add runtime code that checks if a stack frame is mismanaged,
    however our custom assembly deliberately accesses and modifies the parent
    stack frame.  Fortunately we can disable that specific check for the
    function call so do that.
    
    Co-authored-by: Matthew Waters <matthew@centricular.com>

commit aa4dafb159a2e0f74aa39353a1bf23a943f36656
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Mar 23 19:06:08 2021 -0400

    Mention LIBFFI_TMPDIR

commit 70ea259c603e0f84eda766be29d4259f1e8fe5b7
Author: DJ Delorie <dj@delorie.com>
Date:   Tue Mar 23 19:03:45 2021 -0400

    Search $LIBFFI_TMPDIR also (#605)
    
    Most temp file directories need to be hardened against execution, but
    libffi needs execute privileges.  Add a libffi-specific temp directory
    that can be set up by sysadmins as needed with suitable permissions.
    This both ensures that libffi will have a valid temp directory to use
    as well as preventing attempts to access other directories.

commit f58e5ee63263657a7e8f2892d27c012a16facc1a
Author: AndreRH <andre.hentschel@ok.de>
Date:   Tue Mar 23 23:54:00 2021 +0100

    aarch64: Fix closures for win64 (#606)

commit 5865450decd13275b2bde064bd4a0f79bca6dba2
Author: Francisco Boni <boboniboni@gmail.com>
Date:   Tue Mar 23 19:50:09 2021 -0300

    Update ax_cc_maxopt m4 macro (#617)
    
    Keeps libffi's specific changes
    (https://github.com/libffi/libffi/commit/cec3a3a201f17a7f018f25e1a0917bd5206e5a5a#diff-2396a1256ac4b1c6849c931ddb8018bdd984bb2383be21bb819a33b95d8d603f)
    and updates to the latest ax_cc_maxopt.m4
    (http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=commit;h=73ee1b396c21062ee8eeb8721ba5323322110fb5):
    
    ax_cc_maxopt.m4: retain setting of CFLAGS by configure
    
    AX_CC_MAXOPT checks whether CFLAGS was set by the user; if so, the user’s
    setting is respected. This behavior is retained, of course.
    
    However, AX_CC_MAXOPT was then setting CFLAGS="". This overrode the default
    setting by configure, which usually includes -g. Hence, if CFLAGS was not
    set by the user, retain the default setting, to preserve the ability to
    debug.
    
    A typical default setting from configure is "-g -O2". This means that
    AX_CC_MAXOPT might typically set CFLAGS to "-g -O2 -O3". This is fine,
    because the later -O3 will override the earlier -O2. (The only assumption is
    that all compilers that AX_CC_MAXOPT knows behave in this sane way.)

commit 8f44384df17b536615caef951a615655a967103f
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Mar 23 14:24:54 2021 -0400

    Fix formatting

commit 9d491b5e21ffd7fcf2370d998a4832b755d1c9e9
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Mar 23 12:26:37 2021 -0400

    Mention KVX

commit 205cf01b57972fdc8c090fc79192b464dc43fc0d
Author: Anthony Green <green@moxielogic.com>
Date:   Tue Mar 23 11:31:08 2021 -0400

    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.

commit d271dbe0a8b230e566fa3385babdc9cc0ca214ea
Author: Jeremy Huddleston Sequoia <jeremyhu@users.noreply.github.com>
Date:   Sat Mar 20 06:06:28 2021 -0700

    Add some missing #if conditionals from Apple's code drop (#620)
    
    * arm/aarch64: Add FFI_CLOSURES conditionals where appropriate
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
    
    * aarch64: Don't emit the do_closure label when building without FFI_GO_CLOSURES
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

commit bae695da367b6abd83152f8f1e9b1a8b79794c8d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Mar 6 00:09:17 2021 +0800

    Add configuration generator for tvOS and watchOS. (#625)

commit 9ba559217bea0803263a9a9a0bafcf9203606f5b
Author: Madhavan T. Venkataraman <75220914+madvenka786@users.noreply.github.com>
Date:   Fri Mar 5 10:07:30 2021 -0600

    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>

commit 5c63b463b87d3c06102a4a7f05f395929d9ea79b
Author: DJ Delorie <dj@delorie.com>
Date:   Wed Dec 2 16:14:27 2020 -0500

    Use memfd_create() (#604)
    
    memfd_create creates a file in a memory-only filesystem that may
    bypass strict security protocols in filesystem-based temporary
    files.

commit cb8474368cdef3207638d047bd6c707ad8fcb339
Author: hjl-tools <hjl.tools@gmail.com>
Date:   Wed Dec 2 12:52:12 2020 -0800

    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.

commit e70bf987daa7b7b5df2de7579d5c51a888e8bf7d
Author: Tres Finocchiaro <tres.finocchiaro@gmail.com>
Date:   Tue Nov 24 19:13:57 2020 -0500

    Properly quote and resolve msvcc.sh params (#596)

commit 8cc8f446f5aac13e107161dffbc15d1ee1a58878
Author: Mike Hommey <mh@glandium.org>
Date:   Tue Nov 10 20:41:33 2020 +0900

    Allow to build with mingw-clang (#579)
    
    For some reason, compiling sysv.S with mingw-clang fails with:
    ```
    error: invalid variant 'ffi_closure_inner@8'
    ```
    
    This can be fixed (worked around?) by quoting the symbol. This works
    fine with mingw-gcc too.

commit d817d0daa312c58548d7a081aa876027ca103766
Author: Mike Hommey <mh@glandium.org>
Date:   Tue Nov 10 20:39:25 2020 +0900

    Don't use FFI_TYPE_LONGDOUBLE in the jump table in win64*.S (#580)
    
    It may have the same value as FFI_TYPE_DOUBLE per ffi.h, which
    possibly can make things go wrong with .org/ORG.
    
    For instance, GCC complains about "Error: attempt to move .org
    backwards"

commit 56f7df711f70414d4f3663b34e54b122b38bab88
Author: AndreRH <andre.hentschel@ok.de>
Date:   Tue Nov 10 12:27:59 2020 +0100

    aarch64: Allow FFI_WIN64 for winelib (#593)

commit 8111cd06921e80d5d7192ce8d1f64733072fdbcd
Author: Brandon Bergren <git@bdragon.rtk0.net>
Date:   Tue Oct 27 09:07:38 2020 -0500

    Add support for powerpc64le-*-freebsd*. (#581)
    
    Tests pass with no additional changes needed, tested on hardware.

commit 484c1a0d7536be60002473f7bb82223efe139883
Author: Ken <21211439+kencu@users.noreply.github.com>
Date:   Tue Oct 27 07:07:07 2020 -0700

    darwin powerpc: use go closures only if enabled (#583)
    
    SHA: 0ff9419f2e75652426469e256cb7d0748064ad58 added go closures for darwin powerpc AIX, but
    these have not yet been implemented for non-AIX systems
    
    use the go closures only if enabled

commit 032b3cd6f7850f3ebc1269eeab7d1db3ea518d29
Author: Jeremy Huddleston Sequoia <jeremyhu@users.noreply.github.com>
Date:   Tue Oct 27 07:06:21 2020 -0700

    Support building x86 and arm64 without FFI_GO_CLOSURES (#586)
    
    * x86: Support building without FFI_GO_CLOSURES
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
    
    * arm: Support building without FFI_GO_CLOSURES
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>

commit 93cf288ddd59c7cb203c1aba25de5e5b8f308da6
Author: Jeremy Huddleston Sequoia <jeremyhu@users.noreply.github.com>
Date:   Tue Oct 27 07:05:28 2020 -0700

    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>

commit c78fcf88ab13a5cc414826a018dd46c3f886adee
Author: petersn <schmidtnielsenpeter@gmail.com>
Date:   Tue Oct 27 07:02:36 2020 -0700

    Removing unnecessary instruction from ffi_call_unix64 (#588)
    
    unix64.S's `ffi_call_unix64` looks like it used to take six parameters,
    where the sixth said the number of SSE register arguments. However,
    currently the function only takes five parameters, and the number of SSE
    register arguments is encoded in the `struct register_args *` passed as
    the first parameter to `ffi_call_unix64`. This change removes an
    instruction that tries to use this missing sixth parameter as the number
    of SSE arguments.
    
    This fix should not change any behavior, nor fix any bugs, because a few
    instructions later the value moved from %r9d into %eax is overwritten by
    the correct value anyway. This change merely makes the code a tad less
    confusing, because currently the assembly moves from a register (r9)
    whose value is never set.

commit 2d86809db6d1d626a9df40c283ec564ac98ff85d
Author: jacobly0 <jacobly0@users.noreply.github.com>
Date:   Tue Oct 27 10:00:03 2020 -0400

    Fix read-only .eh_frame section test when CFLAGS contains -flto. (#590)

commit f4435980fa2da335fe388db431d4a7946a99a2b9
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Oct 27 23:36:21 2020 +1030

    Power10 libffi fixes (#585)
    
    Power10 pc-relative code doesn't use or preserve r2 as a TOC pointer.
    That means calling between pc-relative and TOC using code can't be
    done without intervening linker stubs, and a call from TOC code to
    pc-relative code must have a nop after the bl in order to restore r2.
    
    Now the PowerPC libffi assembly code doesn't use r2 except for the
    implicit use when making calls back to C, ffi_closure_helper_LINUX64
