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