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 <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Yu-hsin Wang
2023-07-05 17:01:22 +08:00
parent 7cc4f820d7
commit fa905fd512

View File

@@ -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'),