[gem5-dev] Change in gem5/gem5[develop]: util: Add SCons build files for the aarch64 verson of the m5 utility.

2020-04-10 Thread Gabe Black (Gerrit)
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/27213 )


Change subject: util: Add SCons build files for the aarch64 verson of the  
m5 utility.

..

util: Add SCons build files for the aarch64 verson of the m5 utility.

These are currently specific to aarch64, but will be expanded to cover
all other versions of the utility as well.

The intention of these new files is to centralize the build mechanism
for the different versions of the utility so that they have consistent
features, mechanisms, and targets, and so that new features will
automatically be shared by all versions without having to be implemented
in each.

This also sets up a separate build directory which will keep the source
tree clean, and will (with some more development) make it possible to
build multiple versions of the m5 utility at the same time without them
running into each other.

Change-Id: I10018eef6beb4af30a8d3bbab8b82cabd2b3f22c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27213
Reviewed-by: Bobby R. Bruce 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
A util/m5/SConstruct
A util/m5/src/SConscript
2 files changed, 139 insertions(+), 0 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/util/m5/SConstruct b/util/m5/SConstruct
new file mode 100644
index 000..ab34112
--- /dev/null
+++ b/util/m5/SConstruct
@@ -0,0 +1,61 @@
+# Copyright 2020 Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+
+main = Environment()
+
+# Includes which are shared with gem5 itself.
+common_include = Dir('..').Dir('..').Dir('include')
+
+src_dir = Dir('src')
+build_dir = Dir('build')
+
+def abspath(d):
+return os.path.abspath(str(d))
+
+# Universal settings.
+main.Append(CCFLAGS=[ '-O2' ])
+main.Append(CPPPATH=[ common_include ])
+
+# Propogate the environment's PATH setting.
+main['ENV']['PATH'] = os.environ['PATH']
+
+# Cross compiler prefix.
+main['CROSS_COMPILE'] =  
os.environ.get('CROSS_COMPILE', 'aarch64-linux-gnu-')

+
+main['CC'] = '${CROSS_COMPILE}gcc'
+main['AS'] = '${CROSS_COMPILE}as'
+main['LD'] = '${CROSS_COMPILE}ld'
+main['AR'] = '${CROSS_COMPILE}ar'
+
+# Put the sconsign file in the build dir so everything can be deleted at  
once.

+main.SConsignFile(os.path.join(abspath(build_dir), 'sconsign'))
+# Use soft links instead of hard links when setting up a build directory.
+main.SetOption('duplicate', 'soft-copy')
+
+env = main.Clone()
+main.SConscript(src_dir.File('SConscript'),
+variant_dir=build_dir, exports='env')
diff --git a/util/m5/src/SConscript b/util/m5/src/SConscript
new file mode 100644
index 000..a3f7a8f
--- /dev/null
+++ b/util/m5/src/SConscript
@@ -0,0 +1,78 @@
+# Copyright 2020 Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software 

[gem5-dev] Change in gem5/gem5[develop]: util: Add SCons build files for the aarch64 verson of the m5 utility.

2020-03-27 Thread Gabe Black (Gerrit)
Gabe Black has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/27213 )



Change subject: util: Add SCons build files for the aarch64 verson of the  
m5 utility.

..

util: Add SCons build files for the aarch64 verson of the m5 utility.

These are currently specific to aarch64, but will be expanded to cover
all other versions of the utility as well.

The intention of these new files is to centralize the build mechanism
for the different versions of the utility so that they have consistent
features, mechanisms, and targets, and so that new features will
automatically be shared by all versions without having to be implemented
in each.

This also sets up a separate build directory which will keep the source
tree clean, and will (with some more development) make it possible to
build multiple versions of the m5 utility at the same time without them
running into each other.

Change-Id: I10018eef6beb4af30a8d3bbab8b82cabd2b3f22c
---
A util/m5/SConstruct
A util/m5/src/SConscript
2 files changed, 138 insertions(+), 0 deletions(-)



diff --git a/util/m5/SConstruct b/util/m5/SConstruct
new file mode 100644
index 000..d38b39e
--- /dev/null
+++ b/util/m5/SConstruct
@@ -0,0 +1,62 @@
+# Copyright 2020 Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+
+main = Environment()
+
+# Includes which are shared with gem5 itself.
+common_include = Dir('..').Dir('..').Dir('include')
+
+src_dir = Dir('src')
+build_dir = Dir('build')
+
+def abspath(d):
+return os.path.abspath(str(d))
+
+# Universal settings.
+main.Append(CCFLAGS=[ '-O2' ])
+main.Append(LDFLAGS=[ '-static' ])
+main.Append(CPPPATH=[ common_include ])
+
+# Propogate the environment's PATH setting.
+main['ENV']['PATH'] = os.environ['PATH']
+
+# Cross compiler prefix.
+main['CROSS_COMPILE'] =  
os.environ.get('CROSS_COMPILE', 'aarch64-linux-gnu-')

+
+main['CC'] = '${CROSS_COMPILE}gcc'
+main['AS'] = '${CROSS_COMPILE}as'
+main['LD'] = '${CROSS_COMPILE}ld'
+main['AR'] = '${CROSS_COMPILE}ar'
+
+# Put the sconsign file in the build dir so everything can be deleted at  
once.

+main.SConsignFile(os.path.join(abspath(build_dir), 'sconsign'))
+# Use soft links instead of hard links when setting up a build directory.
+main.SetOption('duplicate', 'soft-copy')
+
+env = main.Clone()
+main.SConscript(src_dir.File('SConscript'),
+variant_dir=build_dir, exports='env')
diff --git a/util/m5/src/SConscript b/util/m5/src/SConscript
new file mode 100644
index 000..09c7fca
--- /dev/null
+++ b/util/m5/src/SConscript
@@ -0,0 +1,76 @@
+# Copyright 2020 Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF