Skip to content

Support bun:ffi on Windows ARM64 #28055

Closed

Description

@Hona

What is the problem this feature would solve?

Windows ARM64 support landed in #26215, but bun:ffi is still completely disabled on that target.

Today we explicitly gate it off in:

  • cmake/Options.cmake (DEFAULT_ENABLE_TINYCC OFF on WIN32 && aarch64)
  • src/bun.js/api/ffi.zig (cc(), callback(), dlopen(), linkSymbols() all throw when TinyCC is disabled)
  • test/js/bun/ffi/* (Windows ARM64 is treated as FFI-unavailable)

So native Windows ARM64 Bun exists, but any FFI-backed app/library still fails there.

This seems like the missing follow-up to #9824 / #26215.

What is the feature you are proposing to solve the problem?

Enable bun:ffi on native Windows ARM64.

Concretely, that likely means:

  • vendor/bump TinyCC to a revision that includes the Windows ARM64 work
  • get Bun’s FFI path green on real Windows ARM64
  • unskip/enable the FFI tests on Windows ARM64
  • flip ENABLE_TINYCC on for that target once stable

Relevant detail: Bun is still pinned to an older TinyCC revision in cmake/targets/BuildTinyCC.cmake, while the Windows ARM64 TinyCC work appears to have landed later upstream.

If the plan is not full TinyCC-backed support, it would still be useful to track whether dlopen() / fixed-symbol calls can be split from the TinyCC dependency.

What alternatives have you considered?

  • x64/baseline Bun under emulation: works around it, but not a real fix
  • app-level fallbacks: useful UX-wise, but doesn’t address the platform gap

Activity

  1. bold84 commented on Mar 14, 2026

    @bold84

    TinyCC doesn't support Windows on ARM64 yet. But I have already implemented it using GPT 5.4 with Codex and will create a PR at TinyCC soon.

    Image
  2. bold84 commented on Apr 7, 2026

    @bold84

    oven-sh/tinycc#2

    There you go...

  3. Billzhong2022 commented on Apr 28, 2026

    @Billzhong2022

    Hi team,

    I've reproduced same issue on Windows Arm PC. When will you fix it? Please help share ETA to us.
    Thank you very much!

  4. Jarred-Sumner commented on Jul 7, 2026

    @Jarred-Sumner
    Collaborator

    Status update for anyone following: PR #29476 now enables the Rust-side TinyCC gate on Windows ARM64 as well — see #29476 (comment) for why earlier CI results on that PR were not meaningful for this platform.

  5. Jarred-Sumner commented on Jul 10, 2026

    @Jarred-Sumner
    Collaborator

    Status: this now has a concrete two-step path. The illegal instruction crashes that appear once bun:ffi is actually enabled on windows-aarch64 (#29476) are a missing post-JIT instruction-cache flush in TinyCC's Windows path — already fixed in oven-sh/tinycc@c22ca054, which #33653 pins (with its required libtcc1.c companion). So: merge #33653, then rebase #29476 on it; #29476's windows-11-aarch64 lane is the acceptance test. Analysis with the failing-lane evidence: #29476 (comment)

  6. Jarred-Sumner commented on Jul 10, 2026

    @Jarred-Sumner
    Collaborator

    Correction to my last comment, and the real status: this is solved. Draft PR #33696 (TinyCC upgrade + Windows-ARM64 enablement) has a passing windows-11-aarch64-test-bun lane — the bun:ffi suites run and pass on real Windows ARM64. It required two TinyCC fixes, both already in oven-sh/tinycc: the arm64 post-JIT icache flush (c22ca054), and — the one my earlier comment missed, which was the actual remaining killer — an LLP64 immediate-width bug where ~0xffful zero-extends on Windows hosts so 1<<49 (JSC's DoubleEncodeOffset in every FFI trampoline) silently dropped out of the generated code (8a6cbc12). Remaining work is only mechanical: #33696 drops its two temporary diagnostic commits and undrafts (see also #33653, the TinyCC upgrade it builds on). #29476 appears superseded by it.

  7. added a commit that references this issue on Jul 20, 2026
    f64cade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions