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 <rockdrilla@gmail.com>
PR-URL: #47313
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
rockdrilla authored and RafaelGSS committed Apr 13, 2023
1 parent 8059764 commit 9a4d21d
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 @@ -969,6 +969,10 @@
[ 'OS!="linux" or ossfuzz!="true"', {
'type': 'none',
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # fuzz_env
{
Expand Down Expand Up @@ -1071,6 +1075,10 @@
'Ws2_32.lib',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # cctest

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

Expand All @@ -1142,6 +1154,10 @@
'test/overlapped-checker/main_unix.c'
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
]
}, # overlapped-checker
{
Expand Down Expand Up @@ -1198,6 +1214,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 @@ -1511,6 +1511,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 @@ -1556,6 +1560,10 @@
'<(_msvs_precompiled_source)',
],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
}, # mksnapshot
{
Expand All @@ -1569,6 +1577,10 @@
['want_separate_host_toolset', {
'toolsets': ['host'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
'defines!': [
'_HAS_EXCEPTIONS=0',
Expand Down Expand Up @@ -1603,6 +1615,10 @@
['want_separate_host_toolset', {
'toolsets': ['host'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
'dependencies': [
'torque_base',
Expand Down Expand Up @@ -1635,6 +1651,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 @@ -1651,6 +1671,10 @@
}, {
'dependencies': ['gen-regexp-special-case#target'],
}],
# Avoid excessive LTO
['enable_lto=="true"', {
'ldflags': [ '-fno-lto' ],
}],
],
'actions': [
{
Expand Down

0 comments on commit 9a4d21d

Please sign in to comment.