misc,scons,util: Drop support for GCC 4

Corresponding website update:
https://gem5-review.googlesource.com/c/public/gem5-website/+/33657

Issue-on: https://gem5.atlassian.net/browse/GEM5-218
Change-Id: Ia72edda6229214e2f9d548266a42a0affd49b340
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33659
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/SConstruct b/SConstruct
index 4ac134b..ca3f1a1 100755
--- a/SConstruct
+++ b/SConstruct
@@ -357,24 +357,21 @@
           "src/SConscript to support that compiler.")))
 
 if main['GCC']:
-    # Check for a supported version of gcc. >= 4.8 is chosen for its
-    # level of c++11 support. See
-    # http://gcc.gnu.org/projects/cxx0x.html for details.
     gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
-    if compareVersions(gcc_version, "4.8") < 0:
-        error('gcc version 4.8 or newer required.\n'
+    if compareVersions(gcc_version, "5") < 0:
+        error('gcc version 5 or newer required.\n'
               'Installed version:', gcc_version)
         Exit(1)
 
     main['GCC_VERSION'] = gcc_version
 
-    if compareVersions(gcc_version, '4.9') >= 0:
-        # Incremental linking with LTO is currently broken in gcc versions
-        # 4.9 and above. A version where everything works completely hasn't
-        # yet been identified.
-        #
-        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67548
-        main['BROKEN_INCREMENTAL_LTO'] = True
+    # Incremental linking with LTO is currently broken in gcc versions
+    # 4.9 and above. A version where everything works completely hasn't
+    # yet been identified.
+    #
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67548
+    main['BROKEN_INCREMENTAL_LTO'] = True
+
     if compareVersions(gcc_version, '6.0') >= 0:
         # gcc versions 6.0 and greater accept an -flinker-output flag which
         # selects what type of output the linker should generate. This is
@@ -416,9 +413,6 @@
                                   '-fno-builtin-realloc', '-fno-builtin-free'])
 
 elif main['CLANG']:
-    # Check for a supported version of clang, >= 3.1 is needed to
-    # support similar features as gcc 4.8. See
-    # http://clang.llvm.org/cxx_status.html for details
     clang_version_re = re.compile(".* version (\d+\.\d+)")
     clang_version_match = clang_version_re.search(CXX_version)
     if (clang_version_match):
@@ -462,13 +456,9 @@
 # Add sanitizers flags
 sanitizers=[]
 if GetOption('with_ubsan'):
-    # Only gcc >= 4.9 supports UBSan, so check both the version
-    # and the command-line option before adding the compiler and
-    # linker flags.
-    if not main['GCC'] or compareVersions(main['GCC_VERSION'], '4.9') >= 0:
-        sanitizers.append('undefined')
+    sanitizers.append('undefined')
 if GetOption('with_asan'):
-    # Available for gcc >= 4.8 or llvm >= 3.1 both a requirement
+    # Available for gcc >= 5 or llvm >= 3.1 both a requirement
     # by the build system
     sanitizers.append('address')
     suppressions_file = Dir('util').File('lsan-suppressions').get_abspath()
diff --git a/util/cloudbuild/cloudbuild_create_images.yaml b/util/cloudbuild/cloudbuild_create_images.yaml
index 2faadfa..bed950a 100644
--- a/util/cloudbuild/cloudbuild_create_images.yaml
+++ b/util/cloudbuild/cloudbuild_create_images.yaml
@@ -20,13 +20,6 @@
     - name: 'gcr.io/cloud-builders/docker'
       args: ['build',
             '-t',
-            'gcr.io/$PROJECT_ID/gcc-version-4.8:latest',
-            '--build-arg', 'version=4.8',
-            'util/dockerfiles/ubuntu-18.04_gcc-version']
-
-    - name: 'gcr.io/cloud-builders/docker'
-      args: ['build',
-            '-t',
             'gcr.io/$PROJECT_ID/gcc-version-5:latest',
             '--build-arg', 'version=5',
             'util/dockerfiles/ubuntu-18.04_gcc-version']
@@ -124,7 +117,6 @@
 images: ['gcr.io/$PROJECT_ID/ubuntu-20.04_all-dependencies:latest',
          'gcr.io/$PROJECT_ID/ubuntu-18.04_all-dependencies:latest',
          'gcr.io/$PROJECT_ID/ubuntu-18.04_min-dependencies:latest',
-         'gcr.io/$PROJECT_ID/gcc-version-4.8:latest',
          'gcr.io/$PROJECT_ID/gcc-version-5:latest',
          'gcr.io/$PROJECT_ID/gcc-version-6:latest',
          'gcr.io/$PROJECT_ID/gcc-version-7:latest',