From 99e92e7c3eff8b341f40b3c316c464694d5d9d14 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 22 Oct 2026 12:00:00 +0200 Subject: [PATCH 1/2] deps: V8: cherry-pick 8c44bcb5ac22 Original commit message: Add V8_DISABLE_PRESERVE_MOST for embedders to opt out of preserve_most preserve_most changes the calling convention, which clang encodes in the mangled name (e.g. "U" instead of "A" for cdecl in the Microsoft C++ ABI). A consumer whose toolchain does not support the attribute would reference a differently mangled symbol. This patch adds a V8_DISABLE_PRESERVE_MOST to disable it, so that it's possible to link to V8 using different toolchains, as long as the value of it is set consistently. Refs: https://github.com/nodejs/node/pull/55784 Refs: https://github.com/v8/v8/commit/8c44bcb5ac226bd21eb409827b6c50311e6b212a --- common.gypi | 2 +- deps/v8/include/v8config.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common.gypi b/common.gypi index a8dbd9ba13e4..5e100167a421 100644 --- a/common.gypi +++ b/common.gypi @@ -50,7 +50,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.10', + 'v8_embedder_string': '-node.11', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h index 79bb264d2c9f..ba838157f767 100644 --- a/deps/v8/include/v8config.h +++ b/deps/v8/include/v8config.h @@ -402,6 +402,7 @@ path. Add it with -I to the command line || ((defined(__AARCH64EL__) || defined(_M_ARM64)) /* arm64, but ... */ \ && !defined(_WIN32))) /* not on windows */ \ && !defined(COMPONENT_BUILD) /* no component build */\ + && !defined(V8_DISABLE_PRESERVE_MOST) /* embedder opt-out */ \ && __clang_major__ >= 17 /* clang >= 17 */ # define V8_HAS_ATTRIBUTE_PRESERVE_MOST (__has_attribute(preserve_most)) #endif From aad6a6b832853e7922e89b0dfa8ae61a0e70f330 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 28 Oct 2026 20:43:30 +0100 Subject: [PATCH 2/2] build: set V8_DISABLE_PRESERVE_MOST --- common.gypi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common.gypi b/common.gypi index 5e100167a421..f8588b823119 100644 --- a/common.gypi +++ b/common.gypi @@ -588,6 +588,13 @@ '_HAS_EXCEPTIONS=0', 'BUILDING_V8_SHARED=1', 'BUILDING_UV_SHARED=1', + # Node.js is built with clang-cl but native addons may be built + # with MSVC, which does not support preserve_most. + # As preserve_most changes the mangled name of a function in the + # Microsoft C++ ABI, the addons would fail to link against the + # exported symbols. So this define must be consistely set for + # both the V8 build and addon builds. + 'V8_DISABLE_PRESERVE_MOST', # Stop from defining macros that conflict with # std::min() and std::max(). We don't use (much) # but we still inherit it from uv.h.