Skip to content

Commit

Permalink
build, deps, tools: avoid excessive LTO
Browse files Browse the repository at this point in the history
Don't link intermediate executables with LTO in order to speed up
overall build time.

Signed-off-by: Konstantin Demin <[email protected]>
PR-URL: nodejs#47313
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
rockdrilla authored and MoLow committed Jul 6, 2023
1 parent 7f2bccc commit db910dd
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deps/openssl/openssl-cli.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@
],
},
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}
4 changes: 4 additions & 0 deletions deps/openssl/openssl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
}, {
'includes': ['./openssl-cl_asm.gypi'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
]
}, {
# openssl-fipsmodule target
Expand Down
20 changes: 20 additions & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,10 @@
[ 'OS!="linux" or ossfuzz!="true"', {
'type': 'none',
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # fuzz_env
{
Expand Down Expand Up @@ -1304,6 +1308,10 @@
'Ws2_32.lib',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # cctest

Expand Down Expand Up @@ -1360,6 +1368,10 @@
'Ws2_32.lib',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # embedtest

Expand All @@ -1378,6 +1390,10 @@
'test/overlapped-checker/main_unix.c'
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
]
}, # overlapped-checker
{
Expand Down Expand Up @@ -1434,6 +1450,10 @@
'Ws2_32.lib',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # node_mksnapshot
], # end targets
Expand Down
24 changes: 24 additions & 0 deletions tools/icu/icu-generic.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
Expand All @@ -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
{
Expand All @@ -462,6 +480,12 @@
'<@(icu_src_genccode)',
'no-op.cc',
],
'conditions': [
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
},
],
}
4 changes: 4 additions & 0 deletions tools/v8_gypfiles/d8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
'<(icu_gyp_path):icudata',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
},
],
Expand Down
24 changes: 24 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,10 @@
['want_separate_host_toolset', {
'toolsets': ['host'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
'defines!': [
'BUILDING_V8_SHARED=1',
Expand Down Expand Up @@ -1445,6 +1449,10 @@
'<(_msvs_precompiled_source)',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # mksnapshot
{
Expand All @@ -1458,6 +1466,10 @@
['want_separate_host_toolset', {
'toolsets': ['host'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
'defines!': [
'_HAS_EXCEPTIONS=0',
Expand Down Expand Up @@ -1492,6 +1504,10 @@
['want_separate_host_toolset', {
'toolsets': ['host'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
'dependencies': [
'torque_base',
Expand Down Expand Up @@ -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",
Expand All @@ -1540,6 +1560,10 @@
}, {
'dependencies': ['gen-regexp-special-case#target'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
'actions': [
{
Expand Down

0 comments on commit db910dd

Please sign in to comment.