-def makeEnvirons(target, source, env):
- # 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'])))
-
- # 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'])))
-
- # "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'])))
-
- # 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'])))
-
- # 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)
-
-# The MakeEnvirons Builder defers the full dependency collection until
-# after processing the ISA definition (due to dynamically generated
-# source files). Add this dependency to all targets so they will wait
-# until the environments are completely set up. Otherwise, a second
-# process (e.g. -j2 or higher) will try to compile the requested target,
-# not know how, and fail.
-env.Append(BUILDERS = {'MakeEnvirons' :
- Builder(action=MakeAction(makeEnvirons,
- Transform("ENVIRONS", 1)))})
-
-isa_target = env['PHONY_BASE'] + '-deps'
-environs = env['PHONY_BASE'] + '-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)
-
-# make sure no -deps targets occur before all ISAs are complete
-env.Depends(isa_target, '#all-isas')
-# likewise for -environs targets and all the -deps targets
-env.Depends(environs, '#all-deps')
+disable_partial = False
+if env['PLATFORM'] == 'darwin':
+ # Up until Apple LLVM version 10.0.0 (clang-1000.11.45.5), partial
+ # linked objects do not expose symbols that are marked with the
+ # hidden visibility and consequently building gem5 on Mac OS
+ # fails. As a workaround, we disable partial linking, however, we
+ # may want to revisit in the future.
+ disable_partial = True
+
+# Debug binary
+if 'debug' in needed_envs:
+ makeEnv(env, 'debug', '.do',
+ CCFLAGS = Split(ccflags['debug']),
+ CPPDEFINES = ['DEBUG', 'TRACING_ON=1'],
+ LINKFLAGS = Split(ldflags['debug']),
+ disable_partial=disable_partial)
+
+# Optimized binary
+if 'opt' in needed_envs:
+ makeEnv(env, 'opt', '.o',
+ CCFLAGS = Split(ccflags['opt']),
+ CPPDEFINES = ['TRACING_ON=1'],
+ LINKFLAGS = Split(ldflags['opt']),
+ disable_partial=disable_partial)
+
+# "Fast" binary
+if 'fast' in needed_envs:
+ disable_partial = disable_partial or \
+ (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:
+ makeEnv(env, 'prof', '.po',
+ CCFLAGS = Split(ccflags['prof']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['prof']),
+ disable_partial=disable_partial)
+
+# Profiled binary using google-pprof
+if 'perf' in needed_envs:
+ makeEnv(env, 'perf', '.gpo',
+ CCFLAGS = Split(ccflags['perf']),
+ CPPDEFINES = ['NDEBUG', 'TRACING_ON=0'],
+ LINKFLAGS = Split(ldflags['perf']),
+ disable_partial=disable_partial)