File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed 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