Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/40962 )
Change subject: scons: Streamline the LTO option setting code and add
options for clang.
......................................................................
scons: Streamline the LTO option setting code and add options for clang.
Clang also supports an -flto option, although not with a thread count.
Change-Id: Ifc783ac3ab2e0ea93fad0402b288605a20725aa0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40962
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M SConstruct
1 file changed, 9 insertions(+), 10 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/SConstruct b/SConstruct
index 31f9902..c8e685f 100755
--- a/SConstruct
+++ b/SConstruct
@@ -349,8 +349,7 @@
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 disabled, set the Link-Time Optimization (LTO) flags.
if not GetOption('no_lto'):
# g++ uses "make" to parallelize LTO. The program can be overriden
with
# the environment variable "MAKE", but we currently make no
attempt to
@@ -362,14 +361,9 @@
warning('"make" not found, link time optimization will be '
'single threaded.')
- # Pass the LTO flag when compiling to produce GIMPLE
- # output, we merely create the flags here and only append
- # them later
- main['LTO_CCFLAGS'] = ['-flto%s' % parallelism]
-
- # Use the same amount of jobs for LTO as we are running
- # scons with
- main['LTO_LDFLAGS'] = ['-flto%s' % parallelism]
+ for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
+ # Use the same amount of jobs for LTO as we are running scons
with.
+ main[var] = ['-flto%s' % parallelism]
main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc',
'-fno-builtin-realloc', '-fno-builtin-free'])
@@ -379,6 +373,11 @@
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'):
+ for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
+ main[var] = ['-flto']
+
# clang has a few additional warnings that we disable.
conf.CheckCxxFlag('-Wno-c99-designator')
conf.CheckCxxFlag('-Wno-defaulted-function-deleted')
13 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40962
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: Ifc783ac3ab2e0ea93fad0402b288605a20725aa0
Gerrit-Change-Number: 40962
Gerrit-PatchSet: 15
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s