Bobby R. Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/44887 )
Change subject: scons: Add `--with-lto` to enabled LTO; remove `--no-lto`
......................................................................
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...@gmail.com>
Reviewed-by: Gabe Black <gabe.bl...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M SConstruct
M src/SConscript
2 files changed, 9 insertions(+), 12 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, but someone else must approve; Looks
good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/SConstruct b/SConstruct
index f3d65f0..53fa124 100755
--- a/SConstruct
+++ b/SConstruct
@@ -105,8 +105,8 @@
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 @@
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 @@
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']
diff --git a/src/SConscript b/src/SConscript
index 47aa2ea..bf2d22e 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1435,11 +1435,9 @@
# 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
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44887
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2eea7d447703491675c02730707cf9026cface5f
Gerrit-Change-Number: 44887
Gerrit-PatchSet: 4
Gerrit-Owner: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s