util: Make dot_writer ignore NULL simobjects.
[gem5.git] / src / SConscript
index ed59bd22820486df3efbb4bb5455ffaebd438663..519a0a98656c7c6103e55666127e5e9cb04d5a7c 100755 (executable)
@@ -957,7 +957,7 @@ def variantd(*path):
 # 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)
@@ -1059,6 +1059,14 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
         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")
@@ -1204,10 +1212,14 @@ def makeEnvirons(target, source, env):
 
     # "Fast" binary
     if 'fast' in needed_envs:
+        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']))
+                LINKFLAGS = Split(ldflags['fast']),
+                disable_partial=disable_partial)
 
     # Profiled binary using gprof
     if 'prof' in needed_envs: