Skip to content

deps: update libffi to 3.6.0#64040

Merged
aduh95 merged 2 commits into
mainfrom
actions/truetools-update-libffi
Jun 22, 2026
Merged

deps: update libffi to 3.6.0#64040
aduh95 merged 2 commits into
mainfrom
actions/truetools-update-libffi

Conversation

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

This is an automated update of libffi to 3.6.0.

@nodejs-github-bot nodejs-github-bot added dependencies Pull requests that update a dependency file. ffi Issues and PRs related to experimental Foreign Function Interface support. labels Jun 21, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator Author

Review requested:

  • @nodejs/ffi
  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 21, 2026
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jun 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 21, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator Author

@aduh95 aduh95 added the fast-track PRs that do not need to wait for 72 hours to land. label Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Fast-track has been requested by @aduh95. Please 👍 to approve.

@aduh95

aduh95 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Let's fast-track to include it in the next 26.x release, which I'd like to be able to prepare today

@aduh95

aduh95 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Related compilation failure on AIX and Windows

../deps/libffi/src/powerpc/ffi_darwin.c:1456:14: error: use of undeclared identifier 'PPC_LD_NONE'
 1456 |       return PPC_LD_NONE;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1458:14: error: use of undeclared identifier 'PPC_LD_F32'
 1458 |       return PPC_LD_F32;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1460:14: error: use of undeclared identifier 'PPC_LD_F64'
 1460 |       return PPC_LD_F64;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1463:14: error: use of undeclared identifier 'PPC_LD_F128'
 1463 |       return PPC_LD_F128;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1466:14: error: use of undeclared identifier 'PPC_LD_U8'
 1466 |       return PPC_LD_U8;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1468:14: error: use of undeclared identifier 'PPC_LD_S8'
 1468 |       return PPC_LD_S8;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1470:14: error: use of undeclared identifier 'PPC_LD_U16'
 1470 |       return PPC_LD_U16;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1472:14: error: use of undeclared identifier 'PPC_LD_S16'
 1472 |       return PPC_LD_S16;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1474:14: error: use of undeclared identifier 'PPC_LD_U32'
 1474 |       return PPC_LD_U32;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1477:14: error: use of undeclared identifier 'PPC_LD_S32'
 1477 |       return PPC_LD_S32;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1479:14: error: use of undeclared identifier 'PPC_LD_PTR'
 1479 |       return PPC_LD_PTR;
      |              ^
../deps/libffi/src/powerpc/ffi_darwin.c:1482:14: error: use of undeclared identifier 'PPC_LD_I64'
 1482 |       return PPC_LD_I64;
      |              ^
2 warnings and 12 errors generated.

Comment thread deps/libffi/libffi.gyp
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator Author

@Renegade334 Renegade334 added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Jun 21, 2026
@aduh95

aduh95 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

@nodejs/platform-aix any idea on how to fix the compilation?

@richardlau

Copy link
Copy Markdown
Member

@nodejs/platform-aix any idea on how to fix the compilation?

Why are we compiling ../deps/libffi/src/powerpc/ffi_darwin.c on AIX in the first place?

node/deps/libffi/libffi.gyp

Lines 118 to 126 in 2e19033

['target_arch == "ppc64" and OS == "aix"', {
'variables': {
'libffi_arch_sources': [
'src/powerpc/ffi_darwin.c',
'src/powerpc/aix.S',
'src/powerpc/aix_closure.S',
],
},
}],

@Renegade334

Renegade334 commented Jun 21, 2026

Copy link
Copy Markdown
Member

Why are we compiling ../deps/libffi/src/powerpc/ffi_darwin.c on AIX in the first place?

This appears to be how libffi plays it.

As for the missing defines, these were added to ffi_powerpc.h in this update, but there's clearly something janky going on with the includes. ffi_darwin.c is missing this header, whereas ffi.c/ffi_linux64.c/ffi_sysv.c include it.

/* Common to ppc32 and ppc64 */
#define PPC_LD_NONE 0
#define PPC_LD_R3 1
#define PPC_LD_R3R4 2
#define PPC_LD_F32 3
#define PPC_LD_F64 4
#define PPC_LD_F128 5
#define PPC_LD_U8 6
#define PPC_LD_S8 7
#define PPC_LD_U16 8
#define PPC_LD_S16 9
#ifndef POWERPC64
#define PPC_LD_U32 PPC_LD_R3
#define PPC_LD_S32 PPC_LD_R3
#define PPC_LD_PTR PPC_LD_R3
#define PPC_LD_I64 PPC_LD_R3R4
/* Needed for soft-float long-double. */
#define PPC32_LD_R3R6 10
/* Needed for FFI_SYSV small structure returns. */
#ifdef __LITTLE_ENDIAN__
#define PPC32_SYSV_LD_STRUCT_3 PPC32_LD_R3
#define PPC32_SYSV_LD_STRUCT_5 PPC32_LD_R3R4
#define PPC32_SYSV_LD_STRUCT_6 PPC32_LD_R3R4
#define PPC32_SYSV_LD_STRUCT_7 PPC32_LD_R3R4
#else
#define PPC32_SYSV_LD_STRUCT_3 11
#define PPC32_SYSV_LD_STRUCT_5 12
#define PPC32_SYSV_LD_STRUCT_6 13
#define PPC32_SYSV_LD_STRUCT_7 14
#endif
#else /* POWERPC64 */
#define PPC_LD_U32 10
#define PPC_LD_S32 11
#define PPC_LD_PTR PPC_LD_R3
#define PPC_LD_I64 PPC_LD_R3
/* Used by ELFv2 for homogenous structure returns. */
#define PPC64_LD_VECTOR 12
#define PPC64_LD_VECTOR_HOMOG 13
#define PPC64_LD_FLOAT_HOMOG 14
#define PPC64_LD_DOUBLE_HOMOG 15
#ifdef __LITTLE_ENDIAN__
#define PPC64_LD_STRUCT_3 PPC_LD_U32
#define PPC64_LD_STRUCT_5 PPC_LD_I64
#define PPC64_LD_STRUCT_6 PPC_LD_I64
#define PPC64_LD_STRUCT_7 PPC_LD_I64
#else
#define PPC64_LD_STRUCT_3 16
#define PPC64_LD_STRUCT_5 17
#define PPC64_LD_STRUCT_6 18
#define PPC64_LD_STRUCT_7 19
#endif
#endif /* POWERPC64 */

@aduh95

aduh95 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

@Renegade334

Copy link
Copy Markdown
Member

ffi.c uses the linux64/sysv asm symbols, not the aix symbols, hence (presumably) the linker error. ffi_darwin.c is explicitly the correct source here:

FFI support for Darwin and AIX.

@Renegade334

Renegade334 commented Jun 21, 2026

Copy link
Copy Markdown
Member

Let's give this a go.

https://ci.nodejs.org/job/node-test-commit-aix/63337/

Edit: guess not then 😆

@Renegade334

Renegade334 commented Jun 21, 2026

Copy link
Copy Markdown
Member

I get the sense that this is just busted at source.

The function in ffi_darwin.c that returns these constants still expects to return a ffi_type*, which is consistent with the cif->rtype that was previously returned prior to libffi/libffi@840add3. The respective functions in linux64/sysv have been updated to return an int, which matches the new constants.

I note that libffi only tests powerpc64 builds targeting linux, not darwin or aix.

@Renegade334

Renegade334 commented Jun 21, 2026

Copy link
Copy Markdown
Member

Opened libffi/libffi#987. We have a suggested patch to try, going to give it a go!

https://ci.nodejs.org/job/node-test-commit-aix/63338/

@Renegade334 Renegade334 force-pushed the actions/truetools-update-libffi branch from 4537b46 to 432321b Compare June 21, 2026 21:13
@aduh95

aduh95 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

432321b Would need to be a deps: libffi: cherry-pick …, not a fixup commit

@Renegade334

Renegade334 commented Jun 21, 2026

Copy link
Copy Markdown
Member

👍

Once we confirm the build is green, then it can be landed upstream and we can formally cherry-pick.

@Renegade334 Renegade334 force-pushed the actions/truetools-update-libffi branch from 432321b to b07e414 Compare June 21, 2026 22:56
@Renegade334 Renegade334 added commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. and removed commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jun 21, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator Author

@Renegade334 Renegade334 requested a review from aduh95 June 22, 2026 00:12
nodejs-github-bot and others added 2 commits June 22, 2026 08:55
PR-URL: #64040
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Original commit message:

    powerpc: fix aix/darwin closure build errors

    unbuildable: the PPC_LD_* jump-table indexes (defined in ffi_powerpc.h,
    which this file cannot include) were missing, and the closure helper
    functions still declared an ffi_type* return type inconsistent with the
    PPC_LD_* constants they now return.

    Define the PPC_LD_* constants locally and change the closure helper
    return types to int.

    Fixes #987

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Refs: libffi/libffi@9ca53a1
PR-URL: #64040
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
@aduh95 aduh95 force-pushed the actions/truetools-update-libffi branch from b07e414 to e9a9065 Compare June 22, 2026 06:56
@aduh95 aduh95 merged commit e9a9065 into main Jun 22, 2026
16 of 18 checks passed
@aduh95 aduh95 deleted the actions/truetools-update-libffi branch June 22, 2026 06:56
@aduh95

aduh95 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Landed in 1f806f2...e9a9065

aduh95 pushed a commit that referenced this pull request Jun 22, 2026
PR-URL: #64040
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
aduh95 pushed a commit that referenced this pull request Jun 22, 2026
Original commit message:

    powerpc: fix aix/darwin closure build errors

    unbuildable: the PPC_LD_* jump-table indexes (defined in ffi_powerpc.h,
    which this file cannot include) were missing, and the closure helper
    functions still declared an ffi_type* return type inconsistent with the
    PPC_LD_* constants they now return.

    Define the PPC_LD_* constants locally and change the closure helper
    return types to int.

    Fixes #987

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Refs: libffi/libffi@9ca53a1
PR-URL: #64040
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. dependencies Pull requests that update a dependency file. fast-track PRs that do not need to wait for 72 hours to land. ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants