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 1369
1369
'tools/snapshot/node_mksnapshot.cc' ,
1370
1370
],
1371
1371
1372
+ 'msvs_settings' : {
1373
+ 'VCLinkerTool' : {
1374
+ 'EnableCOMDATFolding' : '1' , # /OPT:NOICF
1375
+ },
1376
+ },
1377
+
1372
1378
'conditions' : [
1373
1379
['node_write_snapshot_as_array_literals=="true"' , {
1374
1380
'defines' : [ 'NODE_MKSNAPSHOT_USE_ARRAY_LITERALS=1' ],
Original file line number Diff line number Diff line change 1710
1710
'sources' : [
1711
1711
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\ "mksnapshot.*?sources = ")' ,
1712
1712
],
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
+ },
1713
1731
'conditions' : [
1714
1732
['want_separate_host_toolset' , {
1715
1733
'toolsets' : ['host' ],
Original file line number Diff line number Diff line change @@ -234,13 +234,30 @@ template("node_gn_build") {
234
234
if (node_use_node_snapshot ) {
235
235
if (current_toolchain == v8_snapshot_toolchain ) {
236
236
executable (" node_mksnapshot" ) {
237
- configs += [ " :node_internal_config" ]
237
+ configs += [ " :node_internal_config" , " :disable_icf " ]
238
238
sources = [
239
239
" src/node_snapshot_stub.cc" ,
240
240
" tools/snapshot/node_mksnapshot.cc" ,
241
241
]
242
242
deps = [ " :libnode" ]
243
243
}
244
+
245
+ # This config disables a link time optimization "ICF", which may merge
246
+ # different functions into one if the function signature and body of them are
247
+ # identical.
248
+ #
249
+ # ICF breaks 1:1 mappings of the external references for V8 snapshot, so we
250
+ # disable it while taking a V8 snapshot.
251
+ config (" disable_icf" ) {
252
+ visibility = [ " :*" ] # Only targets in this file can depend on this.
253
+ if (is_win ) {
254
+ ldflags = [ " /OPT:NOICF" ] # link.exe, but also lld-link.exe.
255
+ } else if (is_apple && ! use_lld ) {
256
+ ldflags = [ " -Wl,-no_deduplicate" ] # ld64.
257
+ } else if (use_gold || use_lld ) {
258
+ ldflags = [ " -Wl,--icf=none" ]
259
+ }
260
+ }
244
261
}
245
262
246
263
action (" run_node_mksnapshot" ) {
You can’t perform that action at this time.
0 commit comments