Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/40815 )
Change subject: scons: Enable LTO for opt builds.
......................................................................
scons: Enable LTO for opt builds.
The name of the build is opt, so it should be fully optomized. Also, the
fast build, the only one with LTO historically, is dangerous to use
since it disables many error checks. I personally run gem5 many times
while developing, iterating and trying to fix bugs, and so want it to
run quickly then too, not just the final time when collecting results.
This has the nice side effect of speeding up the build time of build/X86
significantly (6:20 -> 4:27) due to parallelization of the link, and reduces
the size of the build/X86 directory (with debug compression enabled) from
3.4GB to 2.8GB.
The size of build/X86/python/_m5 is still 1.6GB, so still more than half
of the total size of build/X86.
The debug section compression flags were changed from -Wl,... and
-Wa,... to -gz because the LTO wrapper complains about -Wa options. The
-gz option seems to get the same result, but goes through the compiler
driver without tunneling through it to the assembler or linker with -Wa
or -Wl.
Change-Id: I8feabf99454693fdd100d9e1a64fdeae53362f75
---
M SConstruct
M src/SConscript
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/SConstruct b/SConstruct
index b88b150..14c280e 100755
--- a/SConstruct
+++ b/SConstruct
@@ -621,15 +621,12 @@
CacheDir(main['M5_BUILD_CACHE'])
if GetOption('compress_debug'):
- AsCompressDebugFlag = '-Wa,--compress-debug-sections=zlib'
- LdCompressDebugFlag = '-Wl,--compress-debug-sections=zlib'
- if conf.CheckCxxFlag(AsCompressDebugFlag):
- main.Append(CXXFLAGS=[AsCompressDebugFlag])
+ if conf.CheckCxxFlag('-gz'):
+ main.Append(CXXFLAGS=['-gz'])
else:
warning("Can't enable object file debug section compression")
- if conf.CheckLinkFlag(LdCompressDebugFlag):
- main.Append(LINKFLAGS=[LdCompressDebugFlag],
- SHLINKFLAGS=[LdCompressDebugFlag])
+ if conf.CheckLinkFlag('-gz'):
+ main.Append(LINKFLAGS=['-gz'], SHLINKFLAGS=['-gz'])
else:
warning("Can't enable executable debug section compression")
diff --git a/src/SConscript b/src/SConscript
index aeb7038..49e9558 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1344,8 +1344,9 @@
ccflags[target] += ['-O3']
ldflags[target] += ['-O3']
- ccflags['fast'] += env['LTO_CCFLAGS']
- ldflags['fast'] += env['LTO_LDFLAGS']
+ for target in ['opt', 'fast']:
+ ccflags[target] += env['LTO_CCFLAGS']
+ ldflags[target] += 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/+/40815
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: I8feabf99454693fdd100d9e1a64fdeae53362f75
Gerrit-Change-Number: 40815
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