Skip to content

Commit ad5b353

Browse files
committed
build: build v8 with -fvisibility=hidden -fvisibility-inlines-hidden
1 parent 2f35b1f commit ad5b353

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

node.gyp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,19 @@
490490
['clang==0 and OS!="win"', {
491491
'cflags': [ '-Wno-restrict', ],
492492
}],
493+
# TODO(joyeecheung): investigate if it breaks addons.
494+
# ['OS=="mac"', {
495+
# 'xcode_settings': {
496+
# 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
497+
# 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES' # -fvisibility-inlines-hidden
498+
# },
499+
# }],
500+
# ['OS!="win" or clang==1', {
501+
# 'cflags': [
502+
# '-fvisibility=hidden',
503+
# '-fvisibility-inlines-hidden'
504+
# ],
505+
# }],
493506
# Pointer authentication for ARM64.
494507
['target_arch=="arm64"', {
495508
'target_conditions': [

tools/v8_gypfiles/v8.gyp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,20 @@
4141
'AdditionalOptions': ['/utf-8']
4242
}
4343
},
44+
'defines': [
45+
'BUILDING_V8_SHARED', # Make V8_EXPORT visible.
46+
],
4447
'conditions': [
4548
['OS=="mac"', {
46-
# Hide symbols that are not explicitly exported with V8_EXPORT.
47-
# TODO(joyeecheung): enable it on other platforms. Currently gcc times out
48-
# or run out of memory with -fvisibility=hidden on some machines in the CI.
4949
'xcode_settings': {
5050
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
51+
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES' # -fvisibility-inlines-hidden
5152
},
52-
'defines': [
53-
'BUILDING_V8_SHARED', # Make V8_EXPORT visible.
53+
}],
54+
['OS!="win" or clang==1', {
55+
'cflags': [
56+
'-fvisibility=hidden',
57+
'-fvisibility-inlines-hidden'
5458
],
5559
}],
5660
],

0 commit comments

Comments
 (0)