Skip to content

Support OpenSSL assembly for RISC-V compilation#63868

Closed
wanghan-sanechips wants to merge 3390 commits into
nodejs:mainfrom
wanghan-sanechips:v22.21.1-riscv
Closed

Support OpenSSL assembly for RISC-V compilation#63868
wanghan-sanechips wants to merge 3390 commits into
nodejs:mainfrom
wanghan-sanechips:v22.21.1-riscv

Conversation

@wanghan-sanechips

Copy link
Copy Markdown

This PR introduces complete RISC-V 64 (riscv64) architecture support for Node.js, enabling it to compile and run on RISC-V platforms with optimized performance.

Key Changes

  • Added platform detection for riscv64 in the build system.
  • Integrated an updated version of OpenSSL that includes RISC-V assembly optimizations (e.g., for AES, SHA, and other cryptographic operations).
  • Verified compatibility with the node-v22.21.1 codebase.

Motivation

As the RISC-V ecosystem continues to grow, it's necessary to support Node.js running on RISC-V platforms. This PR adds RISC-V support with OpenSSL assembly optimizations to deliver better performance.

Test

  • Successfully compiled and ran basic tests on a RISC-V 64 platform.

tniessen and others added 30 commits September 20, 2025 03:33
PR-URL: nodejs#59490
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
`ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS` may dereference
`req_wrap_async`, so `CHECK_NOT_NULL(req_wrap_async)` should be used
before and not after.

PR-URL: nodejs#59487
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
There is a flake in the tests. Split them so that people stop
piling more test cases that flake the monolith.

PR-URL: nodejs#59488
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
It has been flaking the CI for two months with no one working on
a fix. Mark it as flaky.

PR-URL: nodejs#59488
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Add a note that negation patterns are not supported.

PR-URL: nodejs#59245
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
42be7f6 (originally included in 19.8.0
and later backported to 18.16.0) added documentation on how to use
`tls.DEFAULT_CIPHERS`.
However, that commit added the documentation with the version specified
as `REAPLCEME`, causing the published documentation to state that
`tls.DEFAULT_CIPHERS` was added in 19.8.0 and 18.16.0, which is
incorrect - that commit states that `tls.DEFAULT_CIPHERS` already
existed, and the only thing it added was an explanation on how to use
it.

In fact, by examining the git log, it can be seen that
`tls.DEFAULT_CIPHERS` was added by commit
af80e7b, which was included in 0.11.3.

Fixes: nodejs#59246
PR-URL: nodejs#59247
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The test `test/parallel/test-debug-process.js` fails on non-English
Windows systems due to a locale-dependent error message string.

The test asserts that a call to `process._debugProcess()` on a
terminated process throws an error with the message
`'The system cannot find the file specified.'`.
While this holds true on an English Windows system,
the test fails on systems with a different display language.

The underlying `WinapiErrnoException` function correctly retrieves the
localized error message from the OS. For example, on a Korean system,
the message is "지정된 파일을 찾을 수 없습니다.". This mismatch causes
an `AssertionError`.

This behavior can be verified directly in PowerShell:

# On Windows with English (US) display language
PS> (New-Object System.ComponentModel.Win32Exception 2).Message
The system cannot find the file specified.

# On Windows with Korean display language
PS> (New-Object System.ComponentModel.Win32Exception 2).Message
지정된 파일을 찾을 수 없습니다.

To make the test robust and environment-agnostic, this commit changes
the assertion to check the language-independent `error.errno` property,
which is consistently `2` for this type of error, instead of the
localized `error.message`.

PR-URL: nodejs#59254
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
PR-URL: nodejs#59456
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
When inspecting errors, node_modules are highlighted with an
underscore. So far namespaced modules only highlighted the namespace
but not the rest of the module name. This is fixed by matching the
full name.
As drive-by it improves the performance slightly by removing the
regular expression in favor of indexOf to identify the right spot.

PR-URL: nodejs#59446
Reviewed-By: Jordan Harband <ljharb@gmail.com>
PR-URL: nodejs#59347
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#59497
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
PR-URL: nodejs#59312
Fixes: nodejs#59290
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#59511
Fixes: nodejs#59508
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#59466
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
This is a gcc-only option, do not pass to clang.

PR-URL: nodejs#59484
Refs: nodejs/build#4091
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
The race can not only happen when the ESM is loaded by
the CommonJS loader, but can also happen to inner
module jobs in the dependency graph.

PR-URL: nodejs#59519
Fixes: nodejs#59366
Refs: https://github.com/abejfehr/node-22.18-issue-repro
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
When no async loader hooks are registered, perform the linking as
synchronously as possible to reduce the chance of races from the
the shared module loading cache.

PR-URL: nodejs#59519
Fixes: nodejs#59366
Refs: https://github.com/abejfehr/node-22.18-issue-repro
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
PR-URL: nodejs#59470
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
PR-URL: nodejs#59523
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#59526
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
PR-URL: nodejs#59517
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Refs: whatwg/compression#34
PR-URL: nodejs#59464
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
PR-URL: nodejs#59455
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
PR-URL: nodejs#59536
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#59532
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: nodejs#59468
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#59226
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Qingyu Deng <i@ayase-lab.com>
PR-URL: nodejs#59516
Refs: nodejs#59498
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#59473
Refs: nodejs#59288
Reviewed-By: Daniel Lemire <daniel@lemire.me>
PR-URL: nodejs#59350
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
deokjinkim and others added 25 commits October 22, 2025 23:43
"bechmark" -> "benchmark" in test-benchmark-readline.js.
And fix test name in test-benchmark-validators.js.

PR-URL: nodejs#59993
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
PR-URL: nodejs#60002
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
There is no need to do the own property check, since the descriptor
is needed right afterwards anyway.

PR-URL: nodejs#60037
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
In these places we can just generate `std::string` directly, so
there's no need to convert to an intermediate C string.

PR-URL: nodejs#60055
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Both of these are already implemented on the superclass.

PR-URL: nodejs#60056
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
If we can just use the classic `THROW_...()` methods directly,
without needing to allocate an `std::string` for the message/format
parameter, let's just do so.

PR-URL: nodejs#60057
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Modernize the code so there is no need to work with raw C strings
anymore.

PR-URL: nodejs#60058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Refs: nodejs#59911
PR-URL: nodejs#59978
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
In particular, this enables passing `std::string_view` instead.

PR-URL: nodejs#60052
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
If we can use a `std::string_view` instead of a `std::string`, let's
just do that instead.

PR-URL: nodejs#60052
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
PR-URL: nodejs#59996
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Abdirahim Musse <abdirahim.musse@ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The `env` parameter for `process.execve` is documented to default
to `process.env`.

PR-URL: nodejs#60029
Refs: nodejs/build#4156
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs#60047
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
PR-URL: nodejs#60024
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fixes: nodejs#60034
PR-URL: nodejs#60103
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Implements the WHATWG DOM specification for passive event listeners,
ensuring that calls to `preventDefault()` are correctly ignored within
a passive listener context.

An internal `kInPassiveListener` state is added to the Event object
to track when a passive listener is executing. The `preventDefault()`
method and the `returnValue` setter are modified to check this state,
as well as the event's `cancelable` property. This state is reliably
cleaned up within a `finally` block to prevent state pollution in
case a listener throws an error.

This resolves previously failing Web Platform Tests (WPT) in
`AddEventListenerOptions-passive.any.js`.

Refs: https://dom.spec.whatwg.org/#dom-event-preventdefault
PR-URL: nodejs#59995
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: nodejs#60039
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#60113
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Use `common.mustCallAtLeast()` to verify that the `'message'` event is
fired.

PR-URL: nodejs#59952
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
PR-URL: nodejs#59128
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#59958
Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#60008
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Specifically, avoid the hazard of unintentionally evaluating
an argument multiple times during macro expansion, and do not
assume the available of particular namespaces in the current scope.

PR-URL: nodejs#60053
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@wanghan-sanechips wanghan-sanechips requested a review from a team as a code owner June 12, 2026 08:41
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/actions
  • @nodejs/devcontainer
  • @nodejs/releasers
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory. labels Jun 12, 2026
@panva panva closed this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.