From 580b8f024e57faa33a1280703a166c29957ed783 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Thu, 6 Apr 2023 03:24:58 +0300 Subject: [PATCH] build, deps, tools: avoid excessive LTO Don't link intermediate executables with LTO in order to speed up overall build time. Signed-off-by: Konstantin Demin PR-URL: https://github.com/nodejs/node/pull/47313 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Richard Lau --- deps/openssl/openssl-cli.gypi | 4 ++++ deps/openssl/openssl.gyp | 4 ++++ node.gyp | 20 ++++++++++++++++++++ tools/icu/icu-generic.gyp | 24 ++++++++++++++++++++++++ tools/v8_gypfiles/d8.gyp | 4 ++++ tools/v8_gypfiles/v8.gyp | 24 ++++++++++++++++++++++++ 6 files changed, 80 insertions(+) diff --git a/deps/openssl/openssl-cli.gypi b/deps/openssl/openssl-cli.gypi index 1209d64e46dbc2..b4c278b4fe8f9f 100644 --- a/deps/openssl/openssl-cli.gypi +++ b/deps/openssl/openssl-cli.gypi @@ -21,5 +21,9 @@ ], }, }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], } diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp index 861bbc5844ca7b..f6b157f8d60813 100644 --- a/deps/openssl/openssl.gyp +++ b/deps/openssl/openssl.gyp @@ -79,6 +79,10 @@ }, { 'includes': ['./openssl-cl_asm.gypi'], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ] }, { # openssl-fipsmodule target diff --git a/node.gyp b/node.gyp index cf52281bb4479b..337a2363b4391b 100644 --- a/node.gyp +++ b/node.gyp @@ -1202,6 +1202,10 @@ [ 'OS!="linux" or ossfuzz!="true"', { 'type': 'none', }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], }, # fuzz_env { @@ -1304,6 +1308,10 @@ 'Ws2_32.lib', ], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], }, # cctest @@ -1360,6 +1368,10 @@ 'Ws2_32.lib', ], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], }, # embedtest @@ -1378,6 +1390,10 @@ 'test/overlapped-checker/main_unix.c' ], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ] }, # overlapped-checker { @@ -1434,6 +1450,10 @@ 'Ws2_32.lib', ], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], }, # node_mksnapshot ], # end targets diff --git a/tools/icu/icu-generic.gyp b/tools/icu/icu-generic.gyp index db45e6fbdff1aa..2655b9e694fc13 100644 --- a/tools/icu/icu-generic.gyp +++ b/tools/icu/icu-generic.gyp @@ -428,6 +428,12 @@ '<@(icu_src_derb)', 'no-op.cc', ], + 'conditions': [ + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], + ], }, # This tool is used to rebuild res_index.res manifests { @@ -439,6 +445,12 @@ 'iculslocs.cc', 'no-op.cc', ], + 'conditions': [ + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], + ], }, # This tool is used to package, unpackage, repackage .dat files # and convert endianesses @@ -451,6 +463,12 @@ '<@(icu_src_icupkg)', 'no-op.cc', ], + 'conditions': [ + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], + ], }, # this is used to convert .dat directly into .obj { @@ -462,6 +480,12 @@ '<@(icu_src_genccode)', 'no-op.cc', ], + 'conditions': [ + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], + ], }, ], } diff --git a/tools/v8_gypfiles/d8.gyp b/tools/v8_gypfiles/d8.gyp index 656e5dffd3e853..ba79ebcba7f9d5 100644 --- a/tools/v8_gypfiles/d8.gyp +++ b/tools/v8_gypfiles/d8.gyp @@ -69,6 +69,10 @@ '<(icu_gyp_path):icudata', ], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], }, ], diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index a721ffb41a119b..ba8b161f0ffa77 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1401,6 +1401,10 @@ ['want_separate_host_toolset', { 'toolsets': ['host'], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], 'defines!': [ 'BUILDING_V8_SHARED=1', @@ -1445,6 +1449,10 @@ '<(_msvs_precompiled_source)', ], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], }, # mksnapshot { @@ -1458,6 +1466,10 @@ ['want_separate_host_toolset', { 'toolsets': ['host'], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], 'defines!': [ '_HAS_EXCEPTIONS=0', @@ -1492,6 +1504,10 @@ ['want_separate_host_toolset', { 'toolsets': ['host'], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], 'dependencies': [ 'torque_base', @@ -1524,6 +1540,10 @@ ['want_separate_host_toolset', { 'toolsets': ['host'], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], 'sources': [ "<(V8_ROOT)/src/regexp/gen-regexp-special-case.cc", @@ -1540,6 +1560,10 @@ }, { 'dependencies': ['gen-regexp-special-case#target'], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], 'actions': [ {