scons: Add --with-lto to enabled LTO; remove --no-lto

LTO is no longer enabled by default and can instead be enabled by
`--with-lto`.

Change-Id: I2eea7d447703491675c02730707cf9026cface5f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44887
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Bobby R. Bruce
2021-04-27 13:51:29 -07:00
parent 679c698c56
commit 1cd7e3471d
2 changed files with 9 additions and 12 deletions

View File

@@ -105,8 +105,8 @@ AddOption('--ignore-style', action='store_true',
AddOption('--gold-linker', action='store_true', help='Use the gold linker')
AddOption('--no-compress-debug', action='store_true',
help="Don't compress debug info in build files")
AddOption('--no-lto', action='store_true',
help='Disable Link-Time Optimization for fast')
AddOption('--with-lto', action='store_true',
help='Enable Link-Time Optimization')
AddOption('--verbose', action='store_true',
help='Print full tool command lines')
AddOption('--without-python', action='store_true',
@@ -328,10 +328,9 @@ if main['GCC']:
error('gcc version 5 or newer required.\n'
'Installed version:', main['CXXVERSION'])
# Add the appropriate Link-Time Optimization (LTO) flags
# unless LTO is explicitly turned off. Note that these flags
# are only used by the fast target.
if not GetOption('no_lto'):
# Add the appropriate Link-Time Optimization (LTO) flags if `--with-lto` is
# set.
if GetOption('with_lto'):
# g++ uses "make" to parallelize LTO. The program can be overriden with
# the environment variable "MAKE", but we currently make no attempt to
# plumb that variable through.
@@ -354,8 +353,8 @@ elif main['CLANG']:
error('clang version 3.9 or newer required.\n'
'Installed version:', main['CXXVERSION'])
# If not disabled, set the Link-Time Optimization (LTO) flags.
if not GetOption('no_lto'):
# Set the Link-Time Optimization (LTO) flags if enabled.
if GetOption('with_lto'):
for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
main[var] = ['-flto']