10BC0 build: disable ICF for mksnapshot · nodejs/node@9d0748c · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d0748c

Browse files
LeszekSwirskitargos
andcommitted
build: disable ICF for mksnapshot
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5447267 Co-authored-by: Michaël Zasso <targos@protonmail.com> PR-URL: #54077 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent 525b3f2 commit 9d0748c

File tree

3 files changed

+42
-1
lines changed
  • 3 files changed

    +42
    -1
    lines changed

    node.gyp

    Lines changed: 6 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1405,6 +1405,12 @@
    14051405
    'tools/snapshot/node_mksnapshot.cc',
    14061406
    ],
    14071407

    1408+
    'msvs_settings': {
    1409+
    'VCLinkerTool': {
    1410+
    'EnableCOMDATFolding': '1', # /OPT:NOICF
    1411+
    },
    1412+
    },
    1413+
    14081414
    'conditions': [
    14091415
    ['node_write_snapshot_as_array_literals=="true"', {
    14101416
    'defines': [ 'NODE_MKSNAPSHOT_USE_ARRAY_LITERALS=1' ],

    tools/v8_gypfiles/v8.gyp

    Lines changed: 18 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1710,6 +1710,24 @@
    17101710
    'sources': [
    17111711
    '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"mksnapshot.*?sources = ")',
    17121712
    ],
    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+
    },
    17131731
    'conditions': [
    17141732
    ['want_separate_host_toolset', {
    17151733
    'toolsets': ['host'],

    unofficial.gni

    Lines changed: 18 additions & 1 deletion
    Original file line numberDiff line numberDiff 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") {

    0 commit comments

    Comments
     (0)
    0