scons: Stop caching the first version of object files.

Don't cache the first version requested of object files to use for
subsequent requests. This was originally put in place to avoid an error
when object files could be built with trivially different command lines,
ie command lines which are technically different but not in a
necessarily meaningful way, or less seriously a warning when the command
lines were the same.

The warning was disabled in an earlier change, and the error was avoided
by using a different object file suffix when building unit tests.

This helps avoid bugs if the object files actually *would* turn out to
be different in a meaningful way based on the flags used, and simplifies
the build.

Change-Id: I6b90e6e36b13adb73e587bb8fc533984f764d95a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48138
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-07-15 02:27:52 -07:00
parent 8317146103
commit 8b3565d507

View File

@@ -222,9 +222,6 @@ class SourceFile(object, metaclass=SourceMeta):
of those. A source file also specifies a set of tags which
describing arbitrary properties of the source file.'''
static_objs = {}
shared_objs = {}
def __init__(self, source, tags=None, add_tags=None, append=None):
if tags is None:
tags='gem5 lib'
@@ -256,22 +253,16 @@ class SourceFile(object, metaclass=SourceMeta):
base.all.append(self)
def static(self, env):
key = (self.tnode, env['OBJSUFFIX'])
if self.append:
env = env.Clone()
env.Append(**self.append)
if not key in self.static_objs:
self.static_objs[key] = env.StaticObject(self.tnode)
return self.static_objs[key]
return env.StaticObject(self.tnode)
def shared(self, env):
key = (self.tnode, env['OBJSUFFIX'])
if self.append:
env = env.Clone()
env.Append(**self.append)
if not key in self.shared_objs:
self.shared_objs[key] = env.SharedObject(self.tnode)
return self.shared_objs[key]
return env.SharedObject(self.tnode)
def bytesToCppArray(code, symbol, data):
'''