Sitelet https://github.com/nodejs/node/pull/53086/commits/f553d5de352023eaf98e12f81ef6e2ef523f63e1
Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
build: disable ICF for mksnapshot
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5447267
Co-authored-by: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
LeszekSwirski and targos committed May 28, 2024
commit f553d5de352023eaf98e12f81ef6e2ef523f63e1
6 changes: 6 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,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' ],
Expand Down
18 changes: 18 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,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'],
Expand Down
19 changes: 18 additions & 1 deletion unofficial.gni
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,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") {
Expand Down