Skip to content

Commit

Permalink
Specify the installed directory of modified glibc-2.31
Browse files Browse the repository at this point in the history
Signed-off-by: Parth Pratim Chatterjee <[email protected]>
  • Loading branch information
ParthPratim committed Aug 25, 2021
1 parent 77cf494 commit 58e0ea1
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def options(opt):
help=('Specify the installed directory of elf-loader'),
dest='with_elf_loader', type='string',
default=None)
opt.add_option('--with-glibc',
help=('Specify the installed directory of Glibc-2.25'),
dest='with_glibc', type='string',
default=None)
opt.add_option('--with-libaspect',
help=('Specify the installed directory of libaspect.so'),
dest='with_libaspect', type='string',
Expand Down Expand Up @@ -99,6 +103,8 @@ def configure(conf):
conf.load('clang_compilation_database', tooldir=['waf-tools'])
conf.load('command', tooldir=['waf-tools'])

conf.env.GLIBC_INSTALL_DIR = conf.options.with_glibc

if Options.options.with_ns3 is not None and os.path.isdir(Options.options.with_ns3):
conf.env['NS3_DIR']= os.path.abspath(Options.options.with_ns3)
if not 'PKG_CONFIG_PATH' in os.environ:
Expand Down Expand Up @@ -759,6 +765,20 @@ def build(bld):
'helper/freebsd-stack-helper.h',
]

SYSROOT = bld.env.GLIBC_INSTALL_DIR
extra_cflags_root = [
'-L'+SYSROOT+'/usr/lib64',
'-I'+SYSROOT+'/include',
'--sysroot='+SYSROOT,
'-Wl,--start-group',
'-Wl,-rpath='+SYSROOT+'/lib64',
'-Wl,--dynamic-linker='+SYSROOT+'/lib64/ld-2.31.so'
]
wl_end_group = [
'-Wl,--end-group'
]

bld.env.append_value('LINKFLAGS',extra_cflags_root+wl_end_group)
module_source = module_source + kernel_source
module_headers = module_headers + kernel_headers
uselib = ns3waf.modules_uselib(bld, ['core', 'network', 'internet', 'netlink'])
Expand All @@ -767,7 +787,7 @@ def build(bld):
headers=module_headers,
use=uselib,
includes=kernel_includes,
cxxflags= ['-Wno-deprecated-declarations'],
cxxflags= extra_cflags_root+['-Wno-deprecated-declarations']+wl_end_group,
lib=['dl'])
# lib=['dl','efence'])

Expand Down Expand Up @@ -820,7 +840,7 @@ def build(bld):
# and forward to the dce_* code
bld.shlib(source = ['model/libc.cc', 'model/libc-setup.cc', 'model/libc-global-variables.cc'],
target='lib/c-ns3',
cxxflags=['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch'],
cxxflags=extra_cflags_root+['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch']+wl_end_group,
defines=['LIBSETUP=libc_setup'],
linkflags=['-nostdlib', '-fno-profile-arcs',
'-Wl,--version-script=' + os.path.join('model', 'libc.version'),
Expand All @@ -829,7 +849,7 @@ def build(bld):
# and forward to the dce_* code
bld.shlib(source = ['model/libc.cc', 'model/libc-setup.cc'],
target='lib/pthread-ns3',
cxxflags=['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch'],
cxxflags=extra_cflags_root+['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch']+wl_end_group,
defines=['LIBSETUP=libpthread_setup'],
linkflags=['-nostdlib', '-fno-profile-arcs',
'-Wl,--version-script=' + os.path.join('model', 'libpthread.version'),
Expand All @@ -839,7 +859,7 @@ def build(bld):
# and forward to the dce_* code
bld.shlib(source = ['model/libc.cc', 'model/libc-setup.cc'],
target='lib/rt-ns3',
cxxflags=['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch'],
cxxflags=extra_cflags_root+['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch']+wl_end_group,
defines=['LIBSETUP=librt_setup'],
linkflags=['-nostdlib', '-fno-profile-arcs',
'-Wl,--version-script=' + os.path.join('model', 'librt.version'),
Expand All @@ -849,7 +869,7 @@ def build(bld):
# and forward to the dce_* code
bld.shlib(source = ['model/libc.cc', 'model/libc-setup.cc'],
target='lib/m-ns3',
cxxflags=['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch'],
cxxflags=extra_cflags_root+['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch']+wl_end_group,
defines=['LIBSETUP=libm_setup'],
linkflags=['-nostdlib', '-fno-profile-arcs',
'-Wl,--version-script=' + os.path.join('model', 'libm.version'),
Expand All @@ -859,7 +879,7 @@ def build(bld):
# and forward to the dce_* code
bld.shlib(source = ['model/libc.cc', 'model/libc-setup.cc'],
target='lib/dl-ns3',
cxxflags=['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch'],
cxxflags=extra_cflags_root+['-g', '-fno-profile-arcs', '-fno-test-coverage', '-Wno-builtin-declaration-mismatch']+wl_end_group,
defines=['LIBSETUP=libdl_setup'],
linkflags=['-nostdlib', '-fno-profile-arcs',
'-Wl,--version-script=' + os.path.join('model', 'libdl.version'),
Expand Down

0 comments on commit 58e0ea1

Please sign in to comment.