Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/58350 )
Change subject: scons: Add a priority field to the SourceLib construct.
......................................................................
scons: Add a priority field to the SourceLib construct.
This helps specify ordering for libraries that need it. Libraries with
a higher priority will be sorted earlier in the list, which can be
necessary when working with static libraries/archives.
The default value for "priority" is zero. It's only really necessary
to ensure relative ordering of particular pairings of libraries, so
it should be ok to use an absolute integer value for this. If you
need to order relative to a library, there is a good chance you're
adding it, or the place it's added is well known and you can easily
find its priority value. It's also unlikely that there would be a
complex series of interactions between libraries that would make a
more complicated system warranted.
Change-Id: Ie94a35e6563c07f8d462a4a52d0173ea3cf4f8de
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58350
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Reviewed-by: Jui-min Lee <f...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Yu-hsin Wang <yuhsi...@google.com>
---
M src/SConscript
1 file changed, 32 insertions(+), 1 deletion(-)
Approvals:
Jui-min Lee: Looks good to me, but someone else must approve
Yu-hsin Wang: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/SConscript b/src/SConscript
index 746d3f1..a7b6cec 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -76,7 +76,9 @@
pass
class SourceLib(SourceItem):
- pass
+ def __init__(self, *args, **kwargs):
+ self.priority = kwargs.pop('priority', 0)
+ super().__init__(*args, **kwargs)
build_tools = Dir('#build_tools')
@@ -388,6 +390,8 @@
env['BUILDDIR'], self.path(env).dir.abspath)
libs = self.libs(env)
+ # Higher priority libraries should be earlier in the list.
+ libs.sort(key=lambda l: l.priority, reverse=True)
if libs:
env.Append(LIBS=list(lib.source for lib in libs))
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/58350
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: Ie94a35e6563c07f8d462a4a52d0173ea3cf4f8de
Gerrit-Change-Number: 58350
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Jui-min Lee <f...@google.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Gabe Black <gabebl...@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