scons: Clone env before modifying it in SharedLib

Without this, modifications to env propagate to unexpected places.
This mirrors behaviour in Executable (where the code was copied from).

Change-Id: I35bbf2f3cc2786eb50ff751c813853971ab284fe
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67233
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Nicolas Boichat
2023-01-06 13:53:55 +00:00
parent ac54c7ffad
commit 68cf65e9b5

View File

@@ -376,6 +376,8 @@ class SharedLib(TopLevelBase):
def declare(self, env):
objs = self.srcs_to_objs(env, self.sources(env))
env = env.Clone()
libs = self.libs(env)
# Higher priority libraries should be earlier in the list.
libs.sort(key=lambda l: l.priority, reverse=True)