Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: build v8 with -fvisibility=hidden on macOS #56275

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
'AdditionalOptions': ['/utf-8']
}
},
# Hide symbols that are not explicitly exported with V8_EXPORT.
# TODO(joyeecheung): enable it on other platforms. Currently gcc times out
# or run out of memory with -fvisibility=hidden on some machines in the CI.
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
},
'defines': [
'BUILDING_V8_SHARED', # Make V8_EXPORT visible.
Copy link
Member

Choose a reason for hiding this comment

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

node/common.gypi

Lines 478 to 479 in 5a868b5

'BUILDING_V8_SHARED=1',
'BUILDING_UV_SHARED=1',
non-blocking: common.gypi probably needs to be consolidated

Copy link
Member Author

@joyeecheung joyeecheung Dec 17, 2024

Choose a reason for hiding this comment

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

I think for addons, common.gypi should define USING_V8_SHARED instead, then in node.gypi we need to undefine it/override it to BUILDING_V8_SHARED when building libnode, though that might be a bit challenging to get right with the messy gyp config inheritance all over the place..for now there should probably not even be any difference on Windows (USING_V8_SHARED only affects Windows AFAICT, but currently both the addons and the Node.js build have BUILDING_V8_SHARED on Windows before and after this PR, even though it's technically not quite right for the addons to do that - not that it's going to be buggy, just less optimized). We can look into it in a follow up.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, agreed that addons should have USING_V8_SHARED defined. Right now, it is defined in node-gyp. So here in common.gypi, it may be removed in a follow-up.

https://github.com/nodejs/node-gyp/blob/b899faed56270d3d8496da7576b5750b264c2c21/addon.gypi#L36

],
},
'targets': [
{
Expand Down
Loading