Gabe Black has uploaded this change for review. ( 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
---
M SConstruct
1 file changed, 9 insertions(+), 10 deletions(-)



diff --git a/SConstruct b/SConstruct
index 906846b..1f6493e 100755
--- a/SConstruct
+++ b/SConstruct
@@ -355,17 +355,11 @@

     main['GCC_VERSION'] = gcc_version

-    # 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'):
-        # 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')]
-
-        # Use the same amount of jobs for LTO as we are running
-        # scons with
-        main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
+        for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
+ # Use the same amount of jobs for LTO as we are running scons with.
+            main[var] = ['-flto=%d' % GetOption('num_jobs')]

main.Append(TCMALLOC_CCFLAGS=['-fno-builtin-malloc', '-fno-builtin-calloc',
                                   '-fno-builtin-realloc', '-fno-builtin-free'])
@@ -376,6 +370,11 @@
         error('clang version 3.9 or newer required.\n'
               'Installed version:', clang_version)

+    # 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')

--
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: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
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

Reply via email to