mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
build: disable ICF for mksnapshot
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5447267 Co-authored-by: Michaël Zasso <targos@protonmail.com> PR-URL: https://github.com/nodejs/node/pull/54077 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
parent
525b3f22d1
commit
9d0748c5df
6
node.gyp
6
node.gyp
@ -1405,6 +1405,12 @@
|
||||
'tools/snapshot/node_mksnapshot.cc',
|
||||
],
|
||||
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'EnableCOMDATFolding': '1', # /OPT:NOICF
|
||||
},
|
||||
},
|
||||
|
||||
'conditions': [
|
||||
['node_write_snapshot_as_array_literals=="true"', {
|
||||
'defines': [ 'NODE_MKSNAPSHOT_USE_ARRAY_LITERALS=1' ],
|
||||
|
@ -1710,6 +1710,24 @@
|
||||
'sources': [
|
||||
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"mksnapshot.*?sources = ")',
|
||||
],
|
||||
'configurations': {
|
||||
# We have to repeat the settings for each configuration because toochain.gypi
|
||||
# defines the default EnableCOMDATFolding value in the configurations dicts.
|
||||
'Debug': {
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'EnableCOMDATFolding': '1', # /OPT:NOICF
|
||||
},
|
||||
},
|
||||
},
|
||||
'Release': {
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'EnableCOMDATFolding': '1', # /OPT:NOICF
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'conditions': [
|
||||
['want_separate_host_toolset', {
|
||||
'toolsets': ['host'],
|
||||
|
@ -237,13 +237,30 @@ template("node_gn_build") {
|
||||
if (node_use_node_snapshot) {
|
||||
if (current_toolchain == v8_snapshot_toolchain) {
|
||||
executable("node_mksnapshot") {
|
||||
configs += [ ":node_internal_config" ]
|
||||
configs += [ ":node_internal_config", ":disable_icf" ]
|
||||
sources = [
|
||||
"src/node_snapshot_stub.cc",
|
||||
"tools/snapshot/node_mksnapshot.cc",
|
||||
]
|
||||
deps = [ ":libnode" ]
|
||||
}
|
||||
|
||||
# This config disables a link time optimization "ICF", which may merge
|
||||
# different functions into one if the function signature and body of them are
|
||||
# identical.
|
||||
#
|
||||
# ICF breaks 1:1 mappings of the external references for V8 snapshot, so we
|
||||
# disable it while taking a V8 snapshot.
|
||||
config("disable_icf") {
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
if (is_win) {
|
||||
ldflags = [ "/OPT:NOICF" ] # link.exe, but also lld-link.exe.
|
||||
} else if (is_apple && !use_lld) {
|
||||
ldflags = [ "-Wl,-no_deduplicate" ] # ld64.
|
||||
} else if (use_gold || use_lld) {
|
||||
ldflags = [ "-Wl,--icf=none" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
action("run_node_mksnapshot") {
|
||||
|
Loading…
Reference in New Issue
Block a user