def createSimObjectParamStruct(target, source, env):
assert len(target) == 1 and len(source) == 1
- name = str(source[0].get_contents())
+ name = source[0].get_text_contents()
obj = sim_objects[name]
code = code_formatter()
return body
def createEnumStrings(target, source, env):
- assert len(target) == 1 and len(source) == 1
+ assert len(target) == 1 and len(source) == 2
- name = str(source[0].get_contents())
+ name = source[0].get_text_contents()
+ use_python = source[1].read()
obj = all_enums[name]
code = code_formatter()
obj.cxx_def(code)
- if env['USE_PYTHON']:
+ if use_python:
obj.pybind_def(code)
code.write(target[0].abspath)
def createEnumDecls(target, source, env):
assert len(target) == 1 and len(source) == 1
- name = str(source[0].get_contents())
+ name = source[0].get_text_contents()
obj = all_enums[name]
code = code_formatter()
code.write(target[0].abspath)
def createSimObjectPyBindWrapper(target, source, env):
- name = source[0].get_contents()
+ name = source[0].get_text_contents()
obj = sim_objects[name]
code = code_formatter()
extra_deps = [ py_source.tnode ]
cc_file = File('enums/%s.cc' % name)
- env.Command(cc_file, Value(name),
+ env.Command(cc_file, [Value(name), Value(env['USE_PYTHON'])],
MakeAction(createEnumStrings, Transform("ENUM STR")))
env.Depends(cc_file, depends + extra_deps)
Source(cc_file)
# environment 'env' with modified object suffix and optional stripped
# binary. Additional keyword arguments are appended to corresponding
# build environment vars.
-def makeEnv(env, label, objsfx, strip = False, **kwargs):
+def makeEnv(env, label, objsfx, strip=False, disable_partial=False, **kwargs):
# SCons doesn't know to append a library suffix when there is a '.' in the
# name. Use '_' instead.
libname = variant('gem5_' + label)
if not srcs:
continue
+ # If partial linking is disabled, add these sources to the build
+ # directly, and short circuit this loop.
+ if disable_partial:
+ for s in srcs:
+ static_objs.append(make_obj(s, True))
+ shared_objs.append(make_obj(s, False))
+ continue
+
# Set up the static partially linked objects.
source_objs = [ make_obj(s, True) for s in srcs ]
file_name = new_env.subst("${OBJPREFIX}lib${OBJSUFFIX}.partial")
MakeAction('ln $SOURCE $TARGET', Transform("HARDLINK")))
new_env.M5Binary = targets[0]
- return new_env
+
+ # Set up regression tests.
+ SConscript(os.path.join(env.root.abspath, 'tests', 'SConscript'),
+ variant_dir=variantd('tests', new_env.Label),
+ exports={ 'env' : new_env }, duplicate=False)
# Start out with the compiler flags common to all compilers,
# i.e. they all use -g for opt and -g -pg for prof
# cause any later Source() calls to be fatal, as a diagnostic.
Source.done()
- envList = []
-
# Debug binary
if 'debug' in needed_envs:
- envList.append(
- makeEnv(env, 'debug', '.do',
- CCFLAGS = Split(ccflags['debug']),
- CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
- LINKFLAGS = Split(ldflags['debug'])))
+ makeEnv(env, 'debug', '.do',
+ CCFLAGS = Split(ccflags['debug']),
+ CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
+ LINKFLAGS = Split(ldflags['debug']))
# Optimized binary
if 'opt' in needed_envs:
- envList.append(
- makeEnv(env, 'opt', '.o',
- CCFLAGS = Split(ccflags['opt']),
- CPPDEFINES = ['TRACING_ON=1'],
- LINKFLAGS = Split(ldflags['opt'])))
+ makeEnv(env, 'opt', '.o',
+ CCFLAGS = Split(ccflags['opt']),
+ CPPDEFINES = ['TRACING_ON=1'],
+ LINKFLAGS = Split(ldflags['opt']))
# "Fast" binary
if 'fast' in needed_envs:
- envList.append(
- makeEnv(env, 'fast', '.fo', strip = True,
- CCFLAGS = Split(ccflags['fast']),
- CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
- LINKFLAGS = Split(ldflags['fast'])))
+ disable_partial = \
+ env.get('BROKEN_INCREMENTAL_LTO', False) and \
+ GetOption('force_lto')
+ makeEnv(env, 'fast', '.fo', strip = True,
+ CCFLAGS = Split(ccflags['fast']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['fast']),
+ disable_partial=disable_partial)
# Profiled binary using gprof
if 'prof' in needed_envs:
- envList.append(
- makeEnv(env, 'prof', '.po',
- CCFLAGS = Split(ccflags['prof']),
- CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
- LINKFLAGS = Split(ldflags['prof'])))
+ makeEnv(env, 'prof', '.po',
+ CCFLAGS = Split(ccflags['prof']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['prof']))
# Profiled binary using google-pprof
if 'perf' in needed_envs:
- envList.append(
- makeEnv(env, 'perf', '.gpo',
- CCFLAGS = Split(ccflags['perf']),
- CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
- LINKFLAGS = Split(ldflags['perf'])))
-
- # Set up the regression tests for each build.
- for e in envList:
- SConscript(os.path.join(env.root.abspath, 'tests', 'SConscript'),
- variant_dir = variantd('tests', e.Label),
- exports = { 'env' : e }, duplicate = False)
+ makeEnv(env, 'perf', '.gpo',
+ CCFLAGS = Split(ccflags['perf']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['perf']))
# The MakeEnvirons Builder defers the full dependency collection until
# after processing the ISA definition (due to dynamically generated
Builder(action=MakeAction(makeEnvirons,
Transform("ENVIRONS", 1)))})
-isa_target = env['PHONY_BASE'] + '-deps'
-environs = env['PHONY_BASE'] + '-environs'
-env.Depends('#all-deps', isa_target)
+isa_target = '#${VARIANT_NAME}-deps'
+environs = '#${VARIANT_NAME}-environs'
+env.Depends('#all-deps', isa_target)
env.Depends('#all-environs', environs)
env.ScanISA(isa_target, File('arch/%s/generated/inc.d' % env['TARGET_ISA']))
envSetup = env.MakeEnvirons(environs, isa_target)