Skip to content

build: set V8_DISABLE_PRESERVE_MOST - #67093

Open
joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:fix-perserve-most
Open

joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:fix-perserve-most

Conversation

@joyeecheung

@joyeecheung joyeecheung commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/8532546

This replaces an old floating patch from #55784 to set the preserve_most attribute more consistently for build Node.js and addons consuming common.gypi. We use the explicit macro instead of toolchain detection so that it stays consistent across toolchains.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

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

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency. labels Oct 28, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@joyeecheung
joyeecheung marked this pull request as ready for review October 29, 2026 11:31
@joyeecheung

Copy link
Copy Markdown
Member Author

(triggering GHA for testing, not ready for review)

joyeecheung and others added 2 commits October 31, 2026 03:28
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: nodejs#55784

    Change-Id: I67b49e739942d4026ac060be35bb39ec22256cbd
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8532546
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#111381}

Refs: v8/v8@c389861
@joyeecheung

joyeecheung commented Oct 31, 2026 •

Copy link
Copy Markdown
Member Author

https://chromium-review.googlesource.com/c/v8/v8/+/8532546 has landed. I backported it to replace the old floating patch with the new approach. This is now ready for review @nodejs/build @nodejs/v8-update

@joyeecheung joyeecheung changed the title build: test V8_DISABLE_PRESERVE_MOST build: set V8_DISABLE_PRESERVE_MOST Oct 31, 2026

@legendecas legendecas left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a #if defined(_WIN32) && !defined(V8_DISABLE_PRESERVE_MOST) / #define V8_DISABLE_PRESERVE_MOST / #endif prose in node.h to ensure that addons not using node-gyp always define V8_DISABLE_PRESERVE_MOST?

@joyeecheung

Copy link
Copy Markdown
Member Author

Should we add a #if defined(_WIN32) && !defined(V8_DISABLE_PRESERVE_MOST) / #define V8_DISABLE_PRESERVE_MOST / #endif prose in node.h to ensure that addons not using node-gyp always define V8_DISABLE_PRESERVE_MOST?

I think that helps partially, yes, although for those consumers there can still be a gap depending on whether they include node.h consistently in all translation units or the order in which they include these headers...

@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 31, 2026
@legendecas

Copy link
Copy Markdown
Member

agree that these addons need more than V8_DISABLE_PRESERVE_MOST already

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 31, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. 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