scons: Fix --with-ubsan/asan compilation flags
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 30 Apr 2018 16:42:38 +0000 (17:42 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 4 May 2018 16:02:46 +0000 (16:02 +0000)
SConstruct was using an undefined env variable; this patch uses the main
Environment variable.

Change-Id: I30ab6b4bbfa6d9a71a30fb33406a799bfb476821
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/10181
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

SConstruct

index 8fde133389c07af090f9724e87691b2319f9aa3d..b382d33770fabdf4d30df9d370405f6ebf9bfba1 100755 (executable)
@@ -481,21 +481,21 @@ if main['GCC']:
     # The address sanitizer is available for gcc >= 4.8
     if GetOption('with_asan'):
         if GetOption('with_ubsan') and \
-                compareVersions(env['GCC_VERSION'], '4.9') >= 0:
-            env.Append(CCFLAGS=['-fsanitize=address,undefined',
-                                '-fno-omit-frame-pointer'],
+                compareVersions(main['GCC_VERSION'], '4.9') >= 0:
+            main.Append(CCFLAGS=['-fsanitize=address,undefined',
+                                 '-fno-omit-frame-pointer'],
                        LINKFLAGS='-fsanitize=address,undefined')
         else:
-            env.Append(CCFLAGS=['-fsanitize=address',
-                                '-fno-omit-frame-pointer'],
+            main.Append(CCFLAGS=['-fsanitize=address',
+                                 '-fno-omit-frame-pointer'],
                        LINKFLAGS='-fsanitize=address')
     # Only gcc >= 4.9 supports UBSan, so check both the version
     # and the command-line option before adding the compiler and
     # linker flags.
     elif GetOption('with_ubsan') and \
-            compareVersions(env['GCC_VERSION'], '4.9') >= 0:
-        env.Append(CCFLAGS='-fsanitize=undefined')
-        env.Append(LINKFLAGS='-fsanitize=undefined')
+            compareVersions(main['GCC_VERSION'], '4.9') >= 0:
+        main.Append(CCFLAGS='-fsanitize=undefined')
+        main.Append(LINKFLAGS='-fsanitize=undefined')
 
 elif main['CLANG']:
     # Check for a supported version of clang, >= 3.1 is needed to