Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12270 )

Change subject: systemc: Change the test binaries to use rpath.
......................................................................

systemc: Change the test binaries to use rpath.

Use rpath to link the gem5 dynamic library into the systemc test
binaries so that they don't have to be run from a particular directory
to resolve all their linking dependencies.

Change-Id: I66b18c23ae6bbf32a959022f8789fc8bdd3a6c6b
Reviewed-on: https://gem5-review.googlesource.com/12270
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/tests/SConscript
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/src/systemc/tests/SConscript b/src/systemc/tests/SConscript
index 086ffee..74ec0e0 100644
--- a/src/systemc/tests/SConscript
+++ b/src/systemc/tests/SConscript
@@ -79,14 +79,24 @@
             env.Append(CPPPATH=test_dir.Dir('include'))
             env.Append(CPPPATH=ext_dir)

+            shared_lib_path = env['SHARED_LIB'][0].abspath
+            sl_dir, sl_base = os.path.split(shared_lib_path)
+            env.Append(LIBPATH=[sl_dir], LIBS=[sl_base])
+
             super(SystemCTestBin, cls).declare_all(env)

         def declare(self, env):
+            env = env.Clone()
             sources = list(self.sources)
             for f in self.filters:
                 sources = Source.all.apply_filter(f)
             objs = self.srcs_to_objs(env, sources)
-            objs = objs + env['SHARED_LIB'] + env['MAIN_OBJS']
+            objs = objs + env['MAIN_OBJS']
+            relpath = os.path.relpath(
+                    env['SHARED_LIB'][0].dir.abspath,
+                    self.path(env).dir.abspath)
+            env.Append(LINKFLAGS=Split('-z origin'))
+ env.Append(RPATH=env.Literal(os.path.join('\\$$ORIGIN', relpath)))
             return super(SystemCTestBin, self).declare(env, objs)

     tests = []

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12270
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I66b18c23ae6bbf32a959022f8789fc8bdd3a6c6b
Gerrit-Change-Number: 12270
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthias Jung <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to