File tree 3 files changed +30
-1
lines changed
3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1319
1319
'winmm.lib' ,
1320
1320
'Ws2_32.lib' ,
1321
1321
],
1322
+ 'msbuild_settings' : {
1323
+ 'Link' : {
1324
+ 'EnableCOMDATFolding' : 'false' , # /OPT:NOICF
1325
+ },
1326
+ },
1322
1327
}],
1323
1328
# Avoid excessive LTO
1324
1329
['enable_lto=="true"' , {
Original file line number Diff line number Diff line change 1700
1700
['enable_lto=="true"' , {
1701
1701
'ldflags' : [ '-fno-lto' ],
1702
1702
}],
1703
+ ['OS=="win"' , {
1704
+ 'msbuild_settings' : {
1705
+ 'Link' : {
1706
+ 'EnableCOMDATFolding' : 'false' , # /OPT:NOICF
1707
+ },
1708
+ },
1709
+ }],
1703
1710
],
1704
1711
}, # mksnapshot
1705
1712
{
Original file line number Diff line number Diff line change @@ -235,13 +235,30 @@ template("node_gn_build") {
235
235
if (node_use_node_snapshot ) {
236
236
if (current_toolchain == v8_snapshot_toolchain ) {
237
237
executable (" node_mksnapshot" ) {
238
- configs += [ " :node_internal_config" ]
238
+ configs += [ " :node_internal_config" , " :disable_icf " ]
239
239
sources = [
240
240
" src/node_snapshot_stub.cc" ,
241
241
" tools/snapshot/node_mksnapshot.cc" ,
242
242
]
243
243
deps = [ " :libnode" ]
244
244
}
245
+
246
+ # This config disables a link time optimization "ICF", which may merge
247
+ # different functions into one if the function signature and body of them are
248
+ # identical.
249
+ #
250
+ # ICF breaks 1:1 mappings of the external references for V8 snapshot, so we
251
+ # disable it while taking a V8 snapshot.
252
+ config (" disable_icf" ) {
253
+ visibility = [ " :*" ] # Only targets in this file can depend on this.
254
+ if (is_win ) {
255
+ ldflags = [ " /OPT:NOICF" ] # link.exe, but also lld-link.exe.
256
+ } else if (is_apple && ! use_lld ) {
257
+ ldflags = [ " -Wl,-no_deduplicate" ] # ld64.
258
+ } else if (use_gold || use_lld ) {
259
+ ldflags = [ " -Wl,--icf=none" ]
260
+ }
261
+ }
245
262
}
246
263
247
264
action (" run_node_mksnapshot" ) {
You can’t perform that action at this time.
0 commit comments