Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/48120 )

Change subject: scons: Make all Executables strip-able, and de-special case .fast.
......................................................................

scons: Make all Executables strip-able, and de-special case .fast.

The build for .fast was set up to produce a stripped executable, and the
unstripped executable was instead named .fast.unstripped. I think the
assumption that a stripped executable is faster than an unstripped
executable is flawed, since the parts of the binary that are removed,
debug symbols, are not loaded into memory anyway, so while the program
is executing it shouldn't be any different or take up any additional
memory. This also made .fast a special case compared to the other build
types, like .opt, .debug, etc.

Instead, this change makes .fast unstripped like all the other binaries,
and also makes it possible to request a stripped version of *any* binary
the build can produce with a .stripped suffix.

Change-Id: I2de82e0951d9f41c30594f32fba50acdd14ed69c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48120
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/SConscript
1 file changed, 11 insertions(+), 14 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/SConscript b/src/SConscript
index f79a657..e4f0c42 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -576,18 +576,16 @@
         env['BIN_RPATH_PREFIX'] = os.path.relpath(
                 env['BUILDDIR'], self.path(env).dir.abspath)

-        if env['STRIP_EXES']:
-            stripped = self.path(env)
-            unstripped = env.File(str(stripped) + '.unstripped')
-            if sys.platform == 'sunos5':
-                cmd = 'cp $SOURCE $TARGET; strip $TARGET'
-            else:
-                cmd = 'strip $SOURCE -o $TARGET'
-            env.Program(unstripped, objs)
-            return env.Command(stripped, unstripped,
-                               MakeAction(cmd, Transform("STRIP")))
+        executable = env.Program(self.path(env), objs)[0]
+
+        if sys.platform == 'sunos5':
+            cmd = 'cp $SOURCE $TARGET; strip $TARGET'
         else:
-            return env.Program(self.path(env), objs)
+            cmd = 'strip $SOURCE -o $TARGET'
+        stripped = env.Command(str(executable) + '.stripped',
+                executable, MakeAction(cmd, Transform("STRIP")))[0]
+
+        return [executable, stripped]

 class GTest(Executable):
     '''Create a unit test based on the google test framework.'''
@@ -1344,7 +1342,7 @@
 # environment 'env' with modified object suffix and optional stripped
 # binary.  Additional keyword arguments are appended to corresponding
 # build environment vars.
-def makeEnv(env, label, objsfx, strip=False, **kwargs):
+def makeEnv(env, label, objsfx, **kwargs):
# SCons doesn't know to append a library suffix when there is a '.' in the
     # name.  Use '_' instead.
     libname = 'gem5_' + label
@@ -1390,7 +1388,6 @@

     # Record some settings for building Executables.
     new_env['EXE_SUFFIX'] = label
-    new_env['STRIP_EXES'] = strip

     for cls in ExecutableMeta.all:
         cls.declare_all(new_env)
@@ -1469,7 +1466,7 @@

 # "Fast" binary
 if 'fast' in needed_envs:
-    makeEnv(env, 'fast', '.fo', strip = True,
+    makeEnv(env, 'fast', '.fo',
             CCFLAGS = Split(ccflags['fast']),
             CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
             LINKFLAGS = Split(ldflags['fast']))

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48120
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: I2de82e0951d9f41c30594f32fba50acdd14ed69c
Gerrit-Change-Number: 48120
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andr...@sandberg.pp.se>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
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