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:
15
SConstruct
15
SConstruct
@@ -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']
|
||||
|
||||
|
||||
@@ -1435,11 +1435,9 @@ if env['GCC']:
|
||||
# the optimization to the ldflags as LTO defers the optimization
|
||||
# to link time
|
||||
for target in ['opt', 'fast', 'prof', 'perf']:
|
||||
ccflags[target] += ['-O3']
|
||||
ldflags[target] += ['-O3']
|
||||
ccflags[target] += ['-O3'] + env['LTO_CCFLAGS']
|
||||
ldflags[target] += ['-O3'] + env['LTO_LDFLAGS']
|
||||
|
||||
ccflags['fast'] += env['LTO_CCFLAGS']
|
||||
ldflags['fast'] += env['LTO_LDFLAGS']
|
||||
elif env['CLANG']:
|
||||
ccflags['debug'] += ['-g', '-O0']
|
||||
# opt, fast, prof and perf all share the same cc flags
|
||||
|
||||
Reference in New Issue
Block a user