scons: Bump minimum gcc version to 4.8
[gem5.git] / src / SConscript
index 6cef4708993a542f5ca90a8543e7d48be74b14dd..bb6f26fc1221820d6fd36e3ac6a6e3e6315a5dce 100755 (executable)
@@ -1083,17 +1083,28 @@ def makeEnv(env, label, objsfx, strip = False, **kwargs):
             new_env.Append(CCFLAGS='-fsanitize=undefined')
             new_env.Append(LINKFLAGS='-fsanitize=undefined')
 
+        # The address sanitizer is available for gcc >= 4.8
+        if GetOption('with_asan'):
+            new_env.Append(CCFLAGS=['-fsanitize=address',
+                                    '-fno-omit-frame-pointer'])
+            new_env.Append(LINKFLAGS='-fsanitize=address')
+
     if env['CLANG']:
         swig_env.Append(CCFLAGS=['-Wno-sometimes-uninitialized',
                                  '-Wno-deprecated-register',
                                  '-Wno-tautological-compare'])
 
-        # All supported clang versions have support for UBSan, so if
-        # asked to use it, append the compiler and linker flags.
+        # We require clang >= 3.1, so there is no need to check any
+        # versions here.
         if GetOption('with_ubsan'):
             new_env.Append(CCFLAGS='-fsanitize=undefined')
             new_env.Append(LINKFLAGS='-fsanitize=undefined')
 
+        if GetOption('with_asan'):
+            new_env.Append(CCFLAGS=['-fsanitize=address',
+                                    '-fno-omit-frame-pointer'])
+            new_env.Append(LINKFLAGS='-fsanitize=address')
+
     werror_env = new_env.Clone()
     # Treat warnings as errors but white list some warnings that we
     # want to allow (e.g., deprecation warnings).
@@ -1241,7 +1252,6 @@ needed_envs = [identifyTarget(target) for target in BUILD_TARGETS]
 if 'all' in needed_envs:
     needed_envs += target_types
 
-gem5_root = Dir('.').up().up().abspath
 def makeEnvirons(target, source, env):
     # cause any later Source() calls to be fatal, as a diagnostic.
     Source.done()
@@ -1290,7 +1300,7 @@ def makeEnvirons(target, source, env):
 
     # Set up the regression tests for each build.
     for e in envList:
-        SConscript(os.path.join(gem5_root, 'tests', 'SConscript'),
+        SConscript(os.path.join(env.root.abspath, 'tests', 'SConscript'),
                    variant_dir = variantd('tests', e.Label),
                    exports = { 'env' : e }, duplicate = False)