File tree 3 files changed +42
-1
lines changed
3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 1405
1405
'tools/snapshot/node_mksnapshot.cc' ,
1406
1406
],
1407
1407
1408
+ 'msvs_settings' : {
1409
+ 'VCLinkerTool' : {
1410
+ 'EnableCOMDATFolding' : '1' , # /OPT:NOICF
1411
+ },
1412
+ },
1413
+
1408
1414
'conditions' : [
1409
1415
['node_write_snapshot_as_array_literals=="true"' , {
1410
1416
'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 @@ -237,13 +237,30 @@ template("node_gn_build") {
237
237
if (node_use_node_snapshot ) {
238
238
if (current_toolchain == v8_snapshot_toolchain ) {
239
239
executable (" node_mksnapshot" ) {
240
- configs += [ " :node_internal_config" ]
240
+ configs += [ " :node_internal_config" , " :disable_icf " ]
241
241
sources = [
242
242
" src/node_snapshot_stub.cc" ,
243
243
" tools/snapshot/node_mksnapshot.cc" ,
244
244
]
245
245
deps = [ " :libnode" ]
246
246
}
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
+ }
247
264
}
248
265
249
266
action (" run_node_mksnapshot" ) {
You can’t perform that action at this time.
0 commit comments