Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/40715 )

Change subject: scons: Add support for debug info compression.
......................................................................

scons: Add support for debug info compression.

If supported this will compress the debug information in object files,
libraries, and binaries. This decreases the size of the build/ARM
directory from 11GB to 7.2GB.

Change-Id: I71919062d23742b7658918b0fa9c4d91d0521fbf
---
M SConstruct
1 file changed, 32 insertions(+), 2 deletions(-)



diff --git a/SConstruct b/SConstruct
index f744c77..87baed8 100755
--- a/SConstruct
+++ b/SConstruct
@@ -383,8 +383,8 @@
         # https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03161.html
         # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69866
         if not GetOption('force_lto'):
-            main.Append(PSHLINKFLAGS='-flinker-output=rel')
-            main.Append(PLINKFLAGS='-flinker-output=rel')
+            main.Append(PSHLINKFLAGS=['-flinker-output=rel'])
+            main.Append(PLINKFLAGS=['-flinker-output=rel'])

     disable_lto = GetOption('no_lto')
     if not disable_lto and main.get('BROKEN_INCREMENTAL_LTO', False) and \
@@ -553,6 +553,24 @@
 main['TIMEOUT'] =  timeout_version and \
     compareVersions(timeout_version[-1], '8.13') >= 0

+def CheckCxxFlag(context, flag):
+    context.Message("Checking for compiler %s support..." % flag)
+    last_cxxflags = context.env['CXXFLAGS']
+    context.env.Append(CXXFLAGS=[flag])
+    ret = context.TryCompile('', '.cc')
+    context.env['CXXFLAGS'] = last_cxxflags
+    context.Result(ret)
+    return ret
+
+def CheckLinkFlag(context, flag):
+    context.Message("Checking for linker %s support..." % flag)
+    last_linkflags = context.env['LINKFLAGS']
+    context.env.Append(LINKFLAGS=[flag])
+    ret = context.TryLink('int main(int, char *[]) { return 0; }', '.cc')
+    context.env['LINKFLAGS'] = last_linkflags
+    context.Result(ret)
+    return ret
+
 # Add a custom Check function to test for structure members.
 def CheckMember(context, include, decl, member, include_quotes="<>"):
     context.Message("Checking for member %s in %s..." %
@@ -602,6 +620,8 @@
                  custom_tests = {
         'CheckMember' : CheckMember,
         'CheckPythonLib' : CheckPythonLib,
+        'CheckCxxFlag' : CheckCxxFlag,
+        'CheckLinkFlag' : CheckLinkFlag,
         })

 # Check if we should compile a 64 bit binary on Mac OS X/Darwin
@@ -641,6 +661,16 @@
     print('Using build cache located at', main['M5_BUILD_CACHE'])
     CacheDir(main['M5_BUILD_CACHE'])

+AsCompressDebugFlag = '-Wa,--compress-debug-sections=zlib-gabi'
+LdCompressDebugFlag = '-Wl,--compress-debug-sections=zlib-gabi'
+if conf.CheckCxxFlag(AsCompressDebugFlag):
+    main.Append(CXXFLAGS=[AsCompressDebugFlag])
+if conf.CheckLinkFlag(LdCompressDebugFlag):
+    main.Append(LINKFLAGS=[LdCompressDebugFlag],
+            SHLINKFLAGS=[LdCompressDebugFlag],
+            PLINKFLAGS=[LdCompressDebugFlag],
+            PSHLINKFLAGS=[LdCompressDebugFlag])
+
 main['USE_PYTHON'] = not GetOption('without_python')
 if main['USE_PYTHON']:
     # Find Python include and library directories for embedding the

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40715
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: I71919062d23742b7658918b0fa9c4d91d0521fbf
Gerrit-Change-Number: 40715
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

Reply via email to