Skip to content

v8: support simdutf without atomic_ref - #65775

Closed
luoqianlin wants to merge 1 commit into
nodejs:mainfrom
luoqianlin:android-simdutf-atomic-fallback
Closed

v8: support simdutf without atomic_ref#65775
luoqianlin wants to merge 1 commit into
nodejs:mainfrom
luoqianlin:android-simdutf-atomic-fallback

Conversation

@luoqianlin

Copy link
Copy Markdown

Version

Current main at 71f5b1cbf0540d1309d58ac181326e5b65f680c7

Platform

Android 11 target, arm64, API 30
Android NDK r27d
Linux x86_64 build host

What steps will reproduce the bug?

./android-configure /path/to/android-ndk-r27d 30 arm64
make -j110

The Android NDK r27 libc++ headers do not provide std::atomic_ref, so
SIMDUTF_ATOMIC_REF is not defined. V8's TypedArray base64 builtins
unconditionally call simdutf's optional atomic_* APIs for SharedArrayBuffer
inputs and fail to compile.

What do you see instead?

error: no member named 'atomic_base64_to_binary_safe' in namespace 'simdutf'
error: no member named 'atomic_binary_to_base64' in namespace 'simdutf'

What is the expected behavior?

The base64 builtins should compile with standard libraries that do not provide
std::atomic_ref. Platforms with SIMDUTF_ATOMIC_REF continue to use the
atomic simdutf APIs; other platforms use the regular simdutf APIs.

Additional information

The change is limited to V8's two SharedArrayBuffer base64 call sites. It does
not change behavior on platforms where SIMDUTF_ATOMIC_REF is available and
does not depend on an Android device, system image, or local checkout path.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/security-wg
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency. labels Sep 4, 2026
@aduh95

aduh95 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

You'd need to send this to upstream V8, and once they accept the patch, we can cherry-pick it here

@luoqianlin

Copy link
Copy Markdown
Author

Closing this PR because the ordinary simdutf fallback is not equivalent for
SharedArrayBuffer inputs. simdutf's atomic_* APIs provide the atomic memory
access required by this code path; calling the ordinary APIs can introduce a
data race and violates the TypedArray semantics. The fallback also did not
compile cleanly with the tested Android NDK r27d toolchain.

The underlying toolchain compatibility issue remains documented in #65771.
We should either use a supported libc++/NDK that provides std::atomic_ref or
develop and review a genuinely atomic implementation before changing these
call sites.

@luoqianlin luoqianlin closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants