Skip to content

Commit

Permalink
build: build v8 with -fvisibility=hidden -fvisibility-inlines-hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Jan 9, 2025
1 parent 2f35b1f commit ad5b353
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
13 changes: 13 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,19 @@
['clang==0 and OS!="win"', {
'cflags': [ '-Wno-restrict', ],
}],
# TODO(joyeecheung): investigate if it breaks addons.
# ['OS=="mac"', {
# 'xcode_settings': {
# 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
# 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES' # -fvisibility-inlines-hidden
# },
# }],
# ['OS!="win" or clang==1', {
# 'cflags': [
# '-fvisibility=hidden',
# '-fvisibility-inlines-hidden'
# ],
# }],
# Pointer authentication for ARM64.
['target_arch=="arm64"', {
'target_conditions': [
Expand Down
14 changes: 9 additions & 5 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@
'AdditionalOptions': ['/utf-8']
}
},
'defines': [
'BUILDING_V8_SHARED', # Make V8_EXPORT visible.
],
'conditions': [
['OS=="mac"', {
# 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
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES' # -fvisibility-inlines-hidden
},
'defines': [
'BUILDING_V8_SHARED', # Make V8_EXPORT visible.
}],
['OS!="win" or clang==1', {
'cflags': [
'-fvisibility=hidden',
'-fvisibility-inlines-hidden'
],
}],
],
Expand Down

0 comments on commit ad5b353

Please sign in to comment.