From 1df41b62215f125a7a7dfa595888f87a8e29c4c8 Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 19 Sep 2023 02:50:37 +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 93e4235a0f3efd..5723830d2d1cbf 100644 --- a/node.gyp +++ b/node.gyp @@ -1225,6 +1225,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 db04cc5162fe0e4c0d2c3e0ccdbe24c44cdfbf4b Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 19 Sep 2023 02:50:38 +0300 Subject: [PATCH 2/3] tools: remove non-working condition condition doesn't apply to this target type (introduced in c3cd75d1) 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 c0f001d231b70cea8119f6cc85db5c0e55b879bb Mon Sep 17 00:00:00 2001 From: Konstantin Demin Date: Tue, 19 Sep 2023 02:50:38 +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 5723830d2d1cbf..a3aa54eddc4056 100644 --- a/node.gyp +++ b/node.gyp @@ -1034,6 +1034,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # fuzz_env { @@ -1113,6 +1117,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # cctest @@ -1170,6 +1178,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ], }, # embedtest @@ -1192,6 +1204,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ] }, # overlapped-checker { @@ -1229,6 +1245,10 @@ ['enable_lto=="true"', { 'ldflags': [ '-fno-lto' ], }], + # Avoid extra debug information + ['v8_enable_handle_zapping==0', { + 'ldflags': [ '-s' ], + }], ] }, { @@ -1292,6 +1312,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",