From fa905fd512b7c29ba01b011b37461362cf991593 Mon Sep 17 00:00:00 2001 From: Yu-hsin Wang Date: Wed, 5 Jul 2023 17:01:22 +0800 Subject: [PATCH] scons: Add -rdynamic when building python embed binary When you build Python from scratch, the modules would be separated shared libraries. They would be dlopen when doing module import. To make the separated shared libraries can share the symbol in the binary, we should add -rdynamic when compliing. Change-Id: I26bf9fd7ea5068fd2d08c8f059b37ff34073e8c2 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/72040 Reviewed-by: Jason Lowe-Power Tested-by: kokoro Maintainer: Jason Lowe-Power --- src/SConscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SConscript b/src/SConscript index 1b4430327c..f54a881f72 100644 --- a/src/SConscript +++ b/src/SConscript @@ -626,6 +626,7 @@ PySource('m5', 'python/m5/info.py') gem5py_m5_env = gem5py_env.Clone() gem5py_env.Append(CPPPATH=env['CPPPATH']) gem5py_env.Append(LIBS='z') +gem5py_env.Append(LINKFLAGS='-rdynamic') gem5py_env.Program(gem5py, 'python/gem5py.cc')[0] m5_module_source = \ Source.all.with_all_tags(env, 'm5_module', 'gem5 lib') @@ -647,6 +648,7 @@ env.AlwaysBuild(tags) # env['SHOBJSUFFIX'] = '${OBJSUFFIX}s' +env.Append(LINKFLAGS='-rdynamic') envs = { 'debug': env.Clone(ENV_LABEL='debug', OBJSUFFIX='.do'),