Skip to content

Commit 7021192

Browse files
committed
build: build v8 with -fvisibility=hidden
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.
1 parent 938a581 commit 7021192

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/v8_gypfiles/v8.gyp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
'AdditionalOptions': ['/utf-8']
4242
}
4343
},
44+
# Hide symbols that are not explicitly exported with V8_EXPORT.
45+
'cflags': ['-fvisibility=hidden'],
46+
'xcode_settings': {
47+
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
48+
},
49+
'defines': [
50+
'BUILDING_V8_SHARED', # Make V8_EXPORT visible.
51+
],
4452
},
4553
'targets': [
4654
{

0 commit comments

Comments
 (0)