Skip to content

Conversation

@robobun
Copy link
Collaborator

@robobun robobun commented Jan 29, 2026

Summary

  • Adds ENABLE_BASELINE option for ARM64 architecture (similar to existing x64 baseline support)
  • Uses -moutline-atomics flag for ARM64 baseline builds to generate runtime-detected atomic implementations
  • Adds -baseline suffix for ARM64 WebKit downloads

Fixes #26556

Problem

Bun 1.3.7 crashes with "Illegal instruction" on older ARM64 CPUs (ARMv8.0-A without LSE support) such as:

  • Cortex-A53 (Raspberry Pi 3/4, Amlogic S905X)
  • Exynos 9611
  • AWS a1 instances

The crash occurs because WebKit's pas_lock.h uses GCC atomic builtins that compile to inline LSE instructions (casa, ldaddl, swpa) when built on ARMv8.1+ CI runners. These instructions don't exist on ARMv8.0-A CPUs.

Solution

The -moutline-atomics flag generates code that performs runtime CPU feature detection and uses the appropriate atomic implementation (LSE on newer CPUs, LL/SC on older CPUs).

Note: This fix requires building and publishing baseline ARM64 WebKit builds with -moutline-atomics for the full fix to work. The Bun build system changes here enable downloading those baseline builds once available.

Test plan

  • Code compiles successfully (CMake configuration tested)
  • Once baseline ARM64 WebKit is published: Test on Raspberry Pi 4 or AWS a1 instance

🤖 Generated with Claude Code

This fixes #26556 where Bun crashes with "Illegal instruction" on older
ARM64 CPUs (ARMv8.0-A without LSE support) like Cortex-A53, Exynos 9611,
and AWS a1 instances.

The fix adds:
1. ENABLE_BASELINE option for ARM64 in Options.cmake
2. -moutline-atomics flag for ARM64 baseline builds in CompilerFlags.cmake
   which generates runtime-detected atomic implementations
3. Baseline suffix for ARM64 WebKit downloads in SetupWebKit.cmake

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@robobun
Copy link
Collaborator Author

robobun commented Jan 29, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

Walkthrough

Introduces ENABLE_BASELINE configuration option for ARM64 architecture to enable outline atomics compilation mode. Modifies compiler flags to conditionally apply -moutline-atomics when enabled, and updates WebKit build suffix to include "-baseline" variant.

Changes

Cohort / File(s) Summary
Configuration Options
cmake/Options.cmake
Adds aarch64-specific branch defining ENABLE_BASELINE option for ARMv8.0-A compatibility, defaulting to OFF.
ARM64 Compiler Flags
cmake/CompilerFlags.cmake
Introduces conditional logic to switch between -moutline-atomics (when ENABLE_BASELINE enabled) and -mtune=ampere1 for both Windows and non-Windows ARM64 paths.
WebKit Build Configuration
cmake/tools/SetupWebKit.cmake
Appends "-baseline" suffix to WEBKIT_SUFFIX variable when ENABLE_BASELINE is true, integrating with existing suffix pipeline.

Suggested reviewers

  • Jarred-Sumner
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding ENABLE_BASELINE support for ARM64 to fix crashes on older CPUs.
Description check ✅ Passed The description covers the problem, solution, and test plan with clear structure and references the linked issue, but deviates from the repository template.
Linked Issues check ✅ Passed The PR fully addresses the linked issue #26556 by implementing ARM64 baseline support with -moutline-atomics flag and baseline suffix for WebKit downloads.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing ARM64 baseline support as required by issue #26556; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux ARM64: Illegal instruction crash on older CPUs (Cortex-A53, RPi4) due to LSE atomics in WebKit

2 participants