Skip to content

Commit

Permalink
build: build v8 with -fvisibility=hidden
Browse files Browse the repository at this point in the history
V8 should be built with -fvisibility=hidden, otherwise
the resulting binary would contain unnecessary symbols. In
particular, on macOS, this leads to 5000+ weak symbols
resolved at runtime, leading to a startup regression.

On macOS this also reduces the binary size about ~10MB.
On Linux the size reduction is around 8MB.
  • Loading branch information
joyeecheung committed Dec 17, 2024
1 parent 938a581 commit 970f133
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
'AdditionalOptions': ['/utf-8']
}
},
'cflags': ['-fvisibility=hidden'],
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
},
},
'targets': [
{
Expand Down

0 comments on commit 970f133

Please sign in to comment.