Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/41773 )
Change subject: scons: Check for "make" when using LTO with gcc.
......................................................................
scons: Check for "make" when using LTO with gcc.
gcc uses "make" to parallelize LTO. If we're using gcc and make isn't
found, we have to use single threaded LTO instead. A warning will let
the user know what's happening and that they might want to correct the
situation.
Technically gcc can use the MAKE environment variable to override the
program it uses, although I assume it still has to be "make" compatible.
Given the fairly low likelihood that someone will need that override and
the fact that scons won't pipe that variable through unless we plumb it
up, we'll just ignore that for now.
Change-Id: I891b213ece2a75bd8a915ee91f4130458dab397b
---
M SConstruct
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/SConstruct b/SConstruct
index cc3af90..19a5da9 100755
--- a/SConstruct
+++ b/SConstruct
@@ -360,14 +360,24 @@
# Add the appropriate Link-Time Optimization (LTO) flags
# unless LTO is explicitly turned off.
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
+ # plumb that variable through.
+ parallelism = ''
+ if main.Detect('make'):
+ parallelism = '=%d' % GetOption('num_jobs')
+ else:
+ 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=%d' % GetOption('num_jobs')]
+ main['LTO_CCFLAGS'] = ['-flto%s' % parallelism]
# Use the same amount of jobs for LTO as we are running
# scons with
- main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
+ main['LTO_LDFLAGS'] = ['-flto%s' % parallelism]
main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc',
'-fno-builtin-realloc', '-fno-builtin-free'])
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41773
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: I891b213ece2a75bd8a915ee91f4130458dab397b
Gerrit-Change-Number: 41773
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s