scons: Reverts LTO for opt, perf and prof builds.
This reverts https://gem5-review.googlesource.com/c/public/gem5/+/40815 and adds the `--with-lto` to enable LTO; and removes `--no-lto`. Change-Id: I7dbd2b555570c90c98f38c7c02eb052571f7b6bd Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44886 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45839 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
15
SConstruct
15
SConstruct
@@ -108,8 +108,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',
|
||||
@@ -341,9 +341,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.
|
||||
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.
|
||||
@@ -371,6 +371,11 @@ elif main['CLANG']:
|
||||
error('clang version 3.9 or newer required.\n'
|
||||
'Installed version:', main['CXXVERSION'])
|
||||
|
||||
# Set the Link-Time Optimization (LTO) flags if enabled.
|
||||
if GetOption('with_lto'):
|
||||
for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
|
||||
main[var] = ['-flto']
|
||||
|
||||
# clang has a few additional warnings that we disable, extraneous
|
||||
# parantheses are allowed due to Ruby's printing of the AST,
|
||||
# finally self assignments are allowed as the generated CPU code
|
||||
|
||||
Reference in New Issue
Block a user