From 2230927b3ec371042b2e80ab8df886d329a158e4 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 19 Sep 2023 02:50:19 +0300 Subject: [PATCH 1/3] build, deps, test: avoid excessive LTO Don't link intermediate executables with LTO in order to speed up overall build time. Signed-off-by: Konstantin Demin --- deps/openssl/openssl.gyp | 4 ++++ node.gyp | 4 ++++ test/addons/dlopen-ping-pong/binding.gyp | 7 ++++++- test/addons/openssl-client-cert-engine/binding.gyp | 4 ++++ test/addons/openssl-key-engine/binding.gyp | 4 ++++ test/addons/openssl-test-engine/binding.gyp | 4 ++++ 6 files changed, 26 insertions(+), 1 deletion(-) diff --git a/deps/openssl/openssl.gyp b/deps/openssl/openssl.gyp index f6b157f8d60813..f2d56b084bea25 100644 --- a/deps/openssl/openssl.gyp +++ b/deps/openssl/openssl.gyp @@ -109,6 +109,10 @@ }, { 'includes': ['./openssl-fips_asm_avx2.gypi'], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], 'direct_dependent_settings': { 'include_dirs': [ 'openssl/include', 'openssl/crypto/include'] diff --git a/node.gyp b/node.gyp index 22a45eb8fd3ac8..bf9e1b4dc5a1ee 100644 --- a/node.gyp +++ b/node.gyp @@ -1213,6 +1213,10 @@ ], }, }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ] }, { diff --git a/test/addons/dlopen-ping-pong/binding.gyp b/test/addons/dlopen-ping-pong/binding.gyp index c3edcf0dbedc57..9e423381a9c5e0 100644 --- a/test/addons/dlopen-ping-pong/binding.gyp +++ b/test/addons/dlopen-ping-pong/binding.gyp @@ -13,7 +13,12 @@ # Enable the shared object to be linked by runtime linker ['OS in "aix os400"', { 'ldflags': [ '-Wl,-G' ] - }]], + }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], + ], }, { 'target_name': 'binding', diff --git a/test/addons/openssl-client-cert-engine/binding.gyp b/test/addons/openssl-client-cert-engine/binding.gyp index 9d5f501fd633bc..c68e648d47fcf7 100644 --- a/test/addons/openssl-client-cert-engine/binding.gyp +++ b/test/addons/openssl-client-cert-engine/binding.gyp @@ -19,6 +19,10 @@ ] }, }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ] } ] diff --git a/test/addons/openssl-key-engine/binding.gyp b/test/addons/openssl-key-engine/binding.gyp index 6f9a8c32c14e29..5b58c4bd8d13f1 100644 --- a/test/addons/openssl-key-engine/binding.gyp +++ b/test/addons/openssl-key-engine/binding.gyp @@ -19,6 +19,10 @@ ] }, }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ] } ] diff --git a/test/addons/openssl-test-engine/binding.gyp b/test/addons/openssl-test-engine/binding.gyp index 132f39e621c316..ffebc3defde37b 100644 --- a/test/addons/openssl-test-engine/binding.gyp +++ b/test/addons/openssl-test-engine/binding.gyp @@ -29,6 +29,10 @@ '-Wno-deprecated-declarations', ], }], + # Avoid excessive LTO + ['enable_lto=="true"', { + 'ldflags': [ '-fno-lto' ], + }], ], }], ], From dc4cbc851209dea7973e8b7329ee5b6efc979710 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 19 Sep 2023 02:50:19 +0300 Subject: [PATCH 2/3] tools: remove non-working condition condition doesn't apply to this target type (introduced in 9a4d21d1) Signed-off-by: Konstantin Demin --- tools/v8_gypfiles/v8.gyp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 109d0ea1aa2e51..27b2d437a7a6b8 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1651,10 +1651,6 @@ }, { 'dependencies': ['gen-regexp-special-case#target'], }], - # Avoid excessive LTO - ['enable_lto=="true"', { - 'ldflags': [ '-fno-lto' ], - }], ], 'actions': [ { From 26269b0bf6d9ca094af584d012556154cbac2fdf Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 19 Sep 2023 02:50:19 +0300 Subject: [PATCH 3/3] build, tools: avoid extra debug information Don't build intermediate executables with debug information in order to save some disk space during build. Signed-off-by: Konstantin Demin --- node.gyp | 24 ++++++++++++++++++++++++ tools/v8_gypfiles/v8.gyp | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/node.gyp b/node.gyp index bf9e1b4dc5a1ee..8ac6c0e46c6bcf 100644 --- a/node.gyp +++ b/node.gyp @@ -993,6 +993,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # fuzz_env { @@ -1101,6 +1105,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # cctest @@ -1158,6 +1166,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # embedtest @@ -1180,6 +1192,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ] }, # overlapped-checker { @@ -1217,6 +1233,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ] }, { @@ -1280,6 +1300,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # node_mksnapshot ], # end targets diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 27b2d437a7a6b8..70ac9f23bc180c 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -1502,6 +1502,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], 'defines!': [ 'BUILDING_V8_SHARED=1', @@ -1544,6 +1548,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # mksnapshot { @@ -1561,6 +1569,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], 'defines!': [ '_HAS_EXCEPTIONS=0', @@ -1599,6 +1611,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], 'dependencies': [ 'torque_base', @@ -1635,6 +1651,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], 'sources': [ "<(V8_ROOT)/src/regexp/gen-regexp-special-case.cc",