File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 14051405 'tools/snapshot/node_mksnapshot.cc' ,
14061406 ],
14071407
1408+ 'msvs_settings' : {
1409+ 'VCLinkerTool' : {
1410+ 'EnableCOMDATFolding' : '1' , # /OPT:NOICF
1411+ },
1412+ },
1413+
14081414 'conditions' : [
14091415 ['node_write_snapshot_as_array_literals=="true"' , {
14101416 'defines' : [ 'NODE_MKSNAPSHOT_USE_ARRAY_LITERALS=1' ],
Original file line number Diff line number Diff line change 17101710 'sources' : [
17111711 '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\ "mksnapshot.*?sources = ")' ,
17121712 ],
1713+ 'configurations' : {
1714+ # We have to repeat the settings for each configuration because toochain.gypi
1715+ # defines the default EnableCOMDATFolding value in the configurations dicts.
1716+ 'Debug' : {
1717+ 'msvs_settings' : {
1718+ 'VCLinkerTool' : {
1719+ 'EnableCOMDATFolding' : '1' , # /OPT:NOICF
1720+ },
1721+ },
1722+ },
1723+ 'Release' : {
1724+ 'msvs_settings' : {
1725+ 'VCLinkerTool' : {
1726+ 'EnableCOMDATFolding' : '1' , # /OPT:NOICF
1727+ },
1728+ },
1729+ },
1730+ },
17131731 'conditions' : [
17141732 ['want_separate_host_toolset' , {
17151733 'toolsets' : ['host' ],
Original file line number Diff line number Diff line change @@ -237,13 +237,30 @@ template("node_gn_build") {
237237 if (node_use_node_snapshot ) {
238238 if (current_toolchain == v8_snapshot_toolchain ) {
239239 executable (" node_mksnapshot" ) {
240- configs += [ " :node_internal_config" ]
240+ configs += [ " :node_internal_config" , " :disable_icf " ]
241241 sources = [
242242 " src/node_snapshot_stub.cc" ,
243243 " tools/snapshot/node_mksnapshot.cc" ,
244244 ]
245245 deps = [ " :libnode" ]
246246 }
247+
248+ # This config disables a link time optimization "ICF", which may merge
249+ # different functions into one if the function signature and body of them are
250+ # identical.
251+ #
252+ # ICF breaks 1:1 mappings of the external references for V8 snapshot, so we
253+ # disable it while taking a V8 snapshot.
254+ config (" disable_icf" ) {
255+ visibility = [ " :*" ] # Only targets in this file can depend on this.
256+ if (is_win ) {
257+ ldflags = [ " /OPT:NOICF" ] # link.exe, but also lld-link.exe.
258+ } else if (is_apple && ! use_lld ) {
259+ ldflags = [ " -Wl,-no_deduplicate" ] # ld64.
260+ } else if (use_gold || use_lld ) {
261+ ldflags = [ " -Wl,--icf=none" ]
262+ }
263+ }
247264 }
248265
249266 action (" run_node_mksnapshot" ) {
You can’t perform that action at this time.
0 commit comments