448 Commits

Author SHA1 Message Date
Gabe Black
07505a30af scons: Get rid of some unused cruft from Ruby/yacc.
These variables are never used, and so don't need to be set.

Change-Id: Ia345e3aa12b4437638943a436d28686b6e60acda
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40868
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
2021-03-16 23:28:02 +00:00
Tiago Mück
dcc2f4caaf scons,mem-ruby: export need_partial_func_reads in SConstruct
need_partial_func_reads should now be modified from protocol specific
files (e.g. src/learning_gem5/part3/SConsopts)

Change-Id: I38039aab6178a019d063d6124200050f2ed7b446
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/43043
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-03-16 15:28:44 +00:00
Gabe Black
8ee05ddd7c scons: Create a small helper function for disecting a build target path.
This function does about half of the work of the loop which determines
the build root and the list of variants.

Change-Id: I4f44d1e2643244a4be889c677b25b83d41a39b19
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40970
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-02-24 06:27:28 +00:00
Gabe Black
69ed25971d scons: Eliminate CXX_V and main_dict_keys in SConstruct.
CXX_V isn't used by anything, and main_dict_keys is unnecessary because
using "in" with the whole main environment (which acts like a dict)
checks against the keys without needing a temporary variable.

Change-Id: Iab07246c00b1969858659043cead1dd657b1707b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40963
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-24 06:27:28 +00:00
Gabe Black
dbe295ab95 scons: Remove an extraneous Exit().
This isn't necessary after error() which exits on its own.

Change-Id: Icad08c1badc73fa8f41013cc69d6cc5a96ff8fdb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40961
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-02-24 06:27:28 +00:00
Gabe Black
41ccb6099b scons: Use SCons' built in CXXVERSION instead of detecting our own.
It's not guaranteed that every compiler will set CXXVERSION, but both
gcc and clang do, and for any check of CXXVERSION to be meaningful, we
have to first check which compiler we're talking about.

Change-Id: Icd15e12832920fec6fa8634bc0fde16cc48e3f41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41596
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-02-24 06:27:28 +00:00
Gabe Black
978bd8759a scons: Enable the clang++ and clang tools.
If these tools aren't enabled and CXX isn't set, scons will look for
generically named compiler aliases like cc and c++. These will generally
work, but if scons knows that the compiler is specifically clang, it
will set the CXXCONFIG variable we can use to do compiler version
checking.

Because scons blindly forces a tool into use if you specify it, we need
to use the FindTool method which will check a list of tools and add the
first one that it actually finds.

Change-Id: Ie6bebb8eab531989575c878bee07189541756d2c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41673
Reviewed-by: Earl Ou <shunhsingou@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-24 06:27:28 +00:00
Gabe Black
4d0b56d679 scons: Check for "make" when using LTO with gcc.
gcc uses "make" to parallelize LTO. If we're using gcc and make isn't
found, we have to use single threaded LTO instead. A warning will let
the user know what's happening and that they might want to correct the
situation.

Technically gcc can use the MAKE environment variable to override the
program it uses, although I assume it still has to be "make" compatible.
Given the fairly low likelihood that someone will need that override and
the fact that scons won't pipe that variable through unless we plumb it
up, we'll just ignore that for now.

Change-Id: I891b213ece2a75bd8a915ee91f4130458dab397b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41773
Reviewed-by: Earl Ou <shunhsingou@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-23 07:52:40 +00:00
Gabe Black
9a0b79459d misc: Fix mismatched struct/class "tags" and reenable that warning.
The mismatches were from places where Params structs had been declared
as classes instead of structs, and ruby's MachineID struct.

A comment describing why the warning had been disabled said that it was
because of libstdc++ version 4.8. As far as I can tell, that version is
old enough to be outside the window we support, and so that should no
longer be a problem. It looks like the oldest version of gcc we
support, 5.0, corresponds with approximately libstdc++ version 6.0.21.

https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning

Change-Id: I75ad92f3723a1883bd47e3919c5572a353344047
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40953
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-19 08:29:00 +00:00
Gabe Black
a0b5b999b0 scons: Enable LTO for opt, perf and prof builds.
The name of the build is opt, so it should be fully optomized. Also, the
fast build, the only one with LTO historically, is dangerous to use
since it disables many error checks. I personally run gem5 many times
while developing, iterating and trying to fix bugs, and so want it to
run quickly then too, not just the final time when collecting results.

Also, since they mirror the opt build, the perf and prof builds also
have LTO options added.

This has the nice side effect of speeding up the build time of build/X86
significantly (6:20 -> 4:27) due to parallelization of the link, and
reduces the size of the build/X86 directory (with debug compression
enabled) from 3.4GB to 2.8GB.

The size of build/X86/python/_m5 is still 1.6GB, so still more than half
of the total size of build/X86.

Change-Id: I8feabf99454693fdd100d9e1a64fdeae53362f75
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40815
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Earl Ou <shunhsingou@google.com>
2021-02-18 02:28:36 +00:00
Gabe Black
83056b7ddb scons: Work around very long command lines and arg size limits.
In the background, scons invokes commands using what is essentially
'sh -c ${CMD}'. It's a little more sophisticated than that, but the net
effect is that all of the arguments of a given command are collected
into a single argument for sh. While Linux has a very generous limit
on the number of command line arguments you can have, and a relatively
generous limit on the total size of the arguments and environment
variables which can be read with "getconf ARG_MAX" (about 2MB only my
system), the limit on an individual argument, defined in the little
documented constant MAX_ARG_STRLEN, is much smaller, 32 pages or
131072 bytes from what I've read.

Unfortunately, when building gem5, especially without partial linking,
the command line for the final linking step can be very long, and with
some extra files brought in with EXTRAS can relatively easily exceed
this limit.

To work around this problem, this change adds a new scons "tool" which
replaces the SPAWN and PSPAWN construction environment variables (not
the shell environment, scon's env, aka main) with wrappes. These
wrappers create a temporary file, write the command into it, and then
tell the original SPAWN/PSPAWN implementation to run that file as the
actual command.

This works, but it has two potential drawbacks. First, it creates
extra temporary files which may add some overhead to the build. The
overhead is likely small, but is non-zero.

Second, while this restores the original breaks between command line
arguments, it doesn't completely avoid the total argument/environment
size limit which would be harder to hit, but does still exist.

Another option would be to use the same sort of technique, but to use
gcc's (and I assume clang's) ability to read options from a file using
an @file argument, where file is replaced with the name of the
arguments.

The upside of this approach is that it avoids all of these limits
since gcc is just reading a file, and the only limits are ones it self
imposes. Also, this would only apply to invocations of gcc, and so
would be worth plumbing in to only affect, say, the linking step.
There would be no hypothetical overhead from creating temp files.

One downside though, is that this is not a universal approach and
would break anything which doesn't understand @file style arguments.
Also, when intercepting calls to the shell, the arguments we're
getting have been made appropriate for that environment (escaping,
quoting, etc). The rules for escaping arguments in an @file may not be
quite the same as for the shell, and so there may be weird cases where
a command line gets garbled this way.

Given the tradeoffs, I think always putting the commands into temp
files and running them as scripts is the way to go.

Change-Id: I0a5288aed745a432ed72ffd990ceded2b9422585
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41273
Reviewed-by: Earl Ou <shunhsingou@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-17 09:42:59 +00:00
Gabe Black
642767e8ef scons: Simplify kvm architecture compatibility check.
The original implementation had a function we'd call back into later
which checked if a given ISA has KVM support on the current host.
Instead, this change reverse that and statically figures out which
single target ISA could possibly run under KVM on this host. Then later,
we can just check if the ISA we're trying to build is that one.

Change-Id: I3e7e06180983dfcc4611181718eb5d6210844d36
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40870
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
e375bbba4e scons: Merge redundant checks for the socket library.
scons can accept more than one library at a time, so lets check for both
at once instead of writing out almost the same check twice.

Change-Id: I82f9bdf59a349e28ca75a615d711051256ec73a4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40869
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
e69453157c scons: Simplify the check for protoc.
Collapse nesting, and constrain the try/except to only the line in that
section which might actually be expected to throw an exception when
things are working normally.

This makes the code easier to read, and won't absorb and discard
exceptions which are thrown for unexpected reasons.

Change-Id: Id3ac417ab5545bef35ed8a87d05211c8ef2f5a50
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40867
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
d7df1ebabb scons: Create a Configure checker for pkg-config.
This will check if a pkg-config package exists at all, and then if it
does will attempt to use the supplied pkg-config arguments and
ParseConfig to set up the environment as needed.

Change-Id: I1495e5370b60dcebb1c9ce38517e84d727abc2fd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40866
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
7ebcb83ac3 scons: Simplify the check for hdf5 support.
Collapse the check_hdf5 to the only place it was called, to set a simple
flag variable. Pull the invariant have_pkg_config check out of
check_hdf5_pkg, since if we don't have pkg-config there's no reason to
even try to use to set up hdf5. Turn the one-off, non-standard "Warning"
print into an actual warning().

Change-Id: I04793ae862aeaf1605467d205837b9dd744f93cb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40865
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
452ff429b4 scons: Simplify backtrace implementation detection.
There are really only two options current, glibc or none. If there's a
working implementation there's no real reason to select none, and if
there isn't there's no other option but to select none.

Instead of building up a list, having a default, and making what option
on the list is selected configurable, boil it down to either using glibc
if that implementation is detected, or warning and using none. Also
merge the "normal" and *BSD versions of the checks to reduce redundancy.

The complexity can be added back in if/when there are other
implementations to choose from.

Change-Id: I27c77996a00018302f4daea40924cf059d5a4323
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40864
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
4c4f2c6502 scons: Simplify check for have_posix_clock.
The "library" argument can actually be a list, in which case each
element of the list is checked, one after the other. Use that rather
than calling the CheckLibWithHeader method multiple times and manually
oring the results.

Change-Id: I5c774be15eaa9a7e52ec3ee5a1bbcc5ef1fa0f41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40863
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
d8072e1460 scons: Move a displaced have_posix_clock check back where it goes.
This check had been separated from the code handling have_posix_clock by
some intervening code doing something else. Bring the check back
alongside the code setting that variable.

Change-Id: I6acb54fddbb5c41d6c38d4b93e649835a4775fa0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40862
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
79d53c83e6 scons: Use conf to determine if some flags are supported.
Use conf rather than checking for particular combinations of OS and/or
compiler versions. This *should* be just as correct, and not require
keeping track of what versions of the tools particular flags were added.

Change-Id: Icaa4c273fe89801e2808e6a814ce476700fd6956
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40861
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-11 19:33:24 +00:00
Gabe Black
9fa94642c4 scons: Pull Configure() to earlier in SConstruct so we can use it more.
This mechanism lets us check if headers are available, flags are
supported, etc. We should use that more often, rather than checking for
specific versions of tools where problematic new warnings were added, etc.

Change-Id: I5b1a6499147f27cc8944fcb8c61eb69e9fa8fb7a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40860
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-10 16:57:17 +00:00
Gabe Black
0f49c4365a scons: Extract the gem5 specific Configure call to its own file.
This modularizes that fairly generic code and pulls it out of the main
SConstruct file.

Change-Id: I5f5edc866af43753b4e0a9cc63774ded0fffe06b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40858
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-10 11:35:56 +00:00
Gabe Black
b173b21d5c scons: Trim down a check for mac OS and arch setting flags.
This check used uname to determine if scons was running on macos, and
then a fairly elaborate check to see if the version was above 9, and if
the hardware supported 64 bit. I think at this point it's safe to assume
both that we're at least at macos 10 which is 19 years old, and that Mac
hardware supports 64 bit.

Change-Id: Ice66df2530bbcc929d3a37e7679634b75ba7b860
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40857
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-10 11:35:28 +00:00
Gabe Black
38d0781985 scons: Remove "TIMEOUT" variable and checks.
This was used when regression tests were run from scons. Since that
hasn't been done for a while, these checks and this setting have no
purpose and can be removed.

Change-Id: Ibe383944f1427571061fd25ed6e97d9acfbbc7f1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40856
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2021-02-10 11:35:11 +00:00
Gabe Black
20f41dfa93 scons: Update the Check(Cxx|Link)Flag checks to set their vars.
This avoids boilerplate where we check to see if flag X is supported,
and if so then set flag X. Since there are shared and static versions of
the linker flags but we only explicitly check the static ones, this
change also adds a parameter to CheckLinkFlag to set both flavors. This
defaults to true since I assume most of the time linking flags will
apply to both.

Change-Id: I983222169e9835aeb98570362f7004e2ef0240d0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40855
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-10 11:34:51 +00:00
Gabe Black
51ca61dbf6 scons: Remove partial linking.
This feature didn't actually provide any benefit in the end, and
increased build directory size and scons complexity.

Change-Id: Ia5aa16a8dd008599645076cea8131799f6086e0f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40795
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-10 11:34:19 +00:00
Gabe Black
79db0bacdd scons: Add support for debug info compression.
If supported this will compress the debug information in object files,
libraries, and binaries. This decreases the size of the build/ARM
directory from 11GB to 7.2GB.

Because the benefit of this mechanism depends on the performance and
capacity of the build machine's storage, it can be disabled with the
--no-compress-debug scons flag. For instance if your storage is very
fast, writing out a larger binary may take less time than compressing
that same number of bytes, plus the time to write out the smaller
file.

This feature seems to make our presubmit test machine run out of memory
when trying to build gem5, and so is disabled in the testing scripts.

Change-Id: I71919062d23742b7658918b0fa9c4d91d0521fbf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40715
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-10 09:05:53 +00:00
Bobby R. Bruce
758011f3c2 scons,python: Fix --without-python flag
Even with the `--without-python` flag, checks were still done to ensure
the correct version of Python was being used. This commit fixes this so
these checks are not performed when `--without-python` is enabled.

Change-Id: I2242f2971a49ef28cff229ad0337bce0a998413d
Issue-on: https://gem5.atlassian.net/browse/GEM5-880
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39715
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Lukas Steiner <lsteiner@rhrk.uni-kl.de>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2021-02-03 19:09:08 +00:00
Andreas Sandberg
d06a193c13 scons: Remove Python 2.7 compatibility code
Remove the dependency on six and most 'import x from __future__'. A
few instances of imports from the future have been left in place to
ensure that Python 2.7 users still get an error message when invoking
scons.

Change-Id: I366275a6040f0084e91198b5b5c2a648bffbf2d2
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39585
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2021-01-22 15:29:12 +00:00
Gabe Black
a4e5d2cbb9 scons: Stop auto including the git tool from the default too override.
SCons has a system of "tools", which basically detect versions of build
tools (compilers, linkers, etc) and set up an environment with the
appropriate build variable substitutions for that tool to be used.

For instance, there would be a "tool" for gcc, and it would detect if
gcc is present on the system, and if so would set the "CC" variable to
"gcc". An actually tool as defined by SCons would be a lot more
sophisticated than that and set more variables, but that's the basic
idea.

To help modularize the gem5 SConstruct file, I moved code which would
set up git commit hooks into a "tool" which helped modularize it and
reduce the size of SConstruct.

This isn't quite right since, while the code does detect if git was
used to check out the source (if there is a .git file at the root), it
doesn't really modify the environment at all. It will also be invoked
every time any environment is set up, although right now that will only
be the DefaultEnvironment, what's used when loose functions like
Builder or Command are called with, and the "main" environment which
all the others are Clone-d from.

Normally, when SCons sets up a new environment, either implicitly or
when Environment() is called, it sets up a bunch of built in tools
which are fixed within SCons itself. If you want, you can add a "tools"
argument to Environment (or to the DefaultEnvironment() function) which
will replace that list of tools. That can be used to make an
environment use the new "git" tool, but it isn't automatic.

SCons also lets you override default tools by creating your own with
the same name as the default. To make loading the git tool automatic,
I added an override "default" tool which, in addition to setting some
defaults which should apply to all environments, also pulled in other
tools, at that time "git" and "mercurial" (RIP).

Unfortunately, that meant that today, apparently particularly with
SCons version 4, *any* Environment would pull in "git", and all of
"git"'s dependencies, even if SCons wasn't set up enough for those to
work.

To break that dependency, this change stops the default tool from
automatically loading the git tool, although it does continue to set
other defaults which have very minimal external dependencies. When
creating the "main" Environment in the SConstruct, the "git" tool is
now added in explicitly. Since the list of tools replaces the original
and doesn't extend it, we have to add in "default" explicitly as well.

Really, the "git" tool should be converted from the tool interface into
something more appropriate, like perhaps a small module under
site_scons which site_init.py can import and call. When that happens,
main can be declared like normal again.

While making this change, I also got rid of a few nonstandard additions
to the main environment that were little used and not really necessary.
When reading the SConstruct, it wasn't very obvious where those extra
values were coming from, and they didn't really add any value.

Change-Id: I574db42fc2196bf62fc13d6754357c753ceb9117
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38616
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-12-21 21:53:33 +00:00
Andreas Sandberg
4af84816a4 scons: Don't check for Python 2
The build system will now refuse to build gem5 if Python 2.x is
detected. Remove Python 2 specific python-config variants from the
list of candidates we try.

Change-Id: Id59be4a2969ce180848e5df02afdfb4a5b8125c1
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36535
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-10-23 16:00:13 +00:00
Andreas Sandberg
bc2e12321a scons: Test if binaries can embed the Python interpreter
Add some more stringent Python tests that ensure that we can link with
and run applications that embed Python. This is implemented by running
building a small c++ program that embeds Python using PyBind11. The
program is run by the build system and prints the version of the
Python interpreter. The version information is then used by the build
system to ensure that the installed version is supported.

Change-Id: I727e0832f171362f5506247c022bea365068a0f6
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36383
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-10-23 16:00:13 +00:00
Bobby R. Bruce
c0ae17c5d4 misc: Re-add -Werror for the gem5 20.2 development
This reverts commit 2a4357bfd0,
https://gem5-review.googlesource.com/c/public/gem5/+/35455

Change-Id: I10de506658bcad542abbb6d2b4f0c416d55bc121
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35495
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-10-01 11:06:28 +00:00
Bobby R. Bruce
d0772a0bfe misc: Merge branch 'release-staging-v20.1.0.0' into develop
Change-Id: I3694b251855b969c7bd3807f34e1b4241d47d586
2020-09-30 20:39:06 -07:00
Bobby R. Bruce
2a4357bfd0 scons: Removed -Werror for the gem5 20.1 release
While gem5 compiles on all our supported compilers, removing the -Werror
flag on the stable branch ensures that, as new compilers are released
with stricter warnings, gem5 remains compilable.

Change-Id: I9a356472dc4d729a3fef9f1455814c900103bd66
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35455
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-10-01 03:05:49 +00:00
Bobby R. Bruce
81779301d8 scons,python: Add warning for when python3-config is not used
We cannot say for certain whether 'python-config' is python2 or python3,
but this patch will produce a warning if 'python3-config' is not used,
stating that support for python2 will be dropped in future releases of
gem5.

Change-Id: I114da359c8768071bf7dd7f2701aae85e3459678
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35256
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-09-29 17:52:15 +00:00
Bobby R. Bruce
5eb9cdd2c6 scons,python: Add python2-config to PYTHON_CONFIG
PYTHON_CONFIG can be python2-config as well as python2.7-config.

Change-Id: I482cb922fcf26b37f67f2aca392e04968ca144bd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35255
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-09-29 17:52:15 +00:00
Bobby R. Bruce
16b2c029f5 scons,python: Prioritize Python3 for PYTHON_CONFIG
Change-Id: I0ac4d90b93f2e0a9384216f759937f7b0aa23d41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34899
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-09-29 17:52:15 +00:00
Gabe Black
dcffee005e scons: Adjust the version of C++ to C++14.
Change-Id: I318d337fc61bca0ae40413c23ee36d59d45a79bc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34820
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-09-23 08:35:26 +00:00
Gabe Black
a83316ec00 scons: Increase the minimum clang version to 3.9.
This matches what's documented elsewhere. We *need* version 3.4 to
support c++14, but we support only as far back as 3.9. Also, the
argument to set c++14 as the standard is different in 3.4 and earlier
(-std=c++1y), so it makes life slightly easier to move past it to 3.9.

Change-Id: I66fa578dd3222c62907496a888f8068ed0918c7b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34819
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-09-20 01:03:46 +00:00
Bobby R. Bruce
a1a2edd2a6 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>
2020-09-05 07:22:40 +00:00
Hoa Nguyen
21abaac89d ext: Revert "base: Use system libelf instead of ext"
This reverts commit bbb32ca1ef,
which tells scons to use the system's libelf instead of
ext/libelf.

Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Change-Id: I3bb3e62f2ef0fbc72983c221d5570edb4b35d157
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33940
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-09-02 20:36:14 +00:00
Nikos Nikoleris
6bd0a394c2 scons: Avoid the unsupported option -Wno-c99-designator in MacOS
Change-Id: I4d95c75915b17531bdd6d9161eb266bb91cd7bef
Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33775
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-09-01 06:25:15 +00:00
Gabe Black
08ab457f13 scons: Remove the AddLocalOption workaround.
The "append" option of the Help() scons method can be used to avoid
clobbering the built in and local option help.

This has the nice side effect of making it easier to add options in
other files since you now only need the built in AddOption provided by
scons itself, not the custom AddLocalOption version.

Change-Id: Ifa566087797d578df0c90f8f4fca70c8152fbf63
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32115
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabeblack@google.com>
2020-08-31 21:31:12 +00:00
Jason Lowe-Power
bbb32ca1ef base: Use system libelf instead of ext
The only change needed is to remove EM_SPARC64, which from what I can
tell was removed from elf.h in 1998.

https://sources.debian.org/src/glibc/2.24-11+deb9u1/ChangeLog.8/#L6134

Change-Id: I0dd7e23ea44b19c2ebd9c6eff7cbaedfe69d821b
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33317
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
2020-08-28 19:54:31 +00:00
Gabe Black
9d1278d551 misc: Delete the critical path annotation code.
This code was at least a little Alpha specific, and now that Alpha is
gone it can no longer be compiled. We could either fix it up to work
with other/all ISAs or delete it, and the consensus was to delete it. It
could potentially be revived in the future by retrieving it from version
control.

Change-Id: Ied073f2b9b166951ecba3442cd762eb19bc690b3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32954
Reviewed-by: Steve Reinhardt <stever@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-08-23 03:17:13 +00:00
Gabe Black
881c257c75 scons: Delete the now unused --update-ref option.
This option was for use with the old scons based regression tests.
Those had been deleted for a while, but some other bits and pieces
related to them were still lying around, depending on this option. Now
that those have been cleaned up, this option can go away.

Change-Id: I95b41dd0a14c51e74d1e527eb40e09f49aaeaf7e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32122
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-08-05 20:40:26 +00:00
Gabe Black
bcd6a7ba34 scons: Remove explicitly set defaults in calls to AddOption.
Like the optparse module's add_option method, most keyword arguments
have sensible default values. We should avoid setting those explicitly
when calling AddOption, since it usually doesn't make anything clearer
and just adds more text to wade through.

Change-Id: I70e425d9f1a0da1cafcc3d7dd24bfde18c0b3f35
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32116
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
2020-08-05 20:22:28 +00:00
Gabe Black
e15b4afe6f scons: Update some scons bug report URLs.
It appears that scons bugs are not on tigris.org any more and are now
on github, although fortunately old bugs seem to have been ported over
and have the same numbering.

This CL updates URLs which were in comments in the gem5 source,
specifically in scons scripts, to point to the corresponding github
version.

I also checked to see if these bugs were still open, or if we could
remove our workarounds for them.

1. 2356 is still open, and has been fairly recently assigned.
2. 2611 is marked as fixed. We might be able to implement the
   workaround in its last comment from August of 2019.
3. 2811 has been marked fixed, and as best I can tell the fix first
   appeared in around version 3.0 of scons. If/when that is our
   minimum version, we can remove the workaround in
   site_scons/site_tools/default.py. That is mostly fixing an annoying
   spurious rebuild by scons which does not affect correctness, so even
   if we remove that workaround we shouldn't break earlier versions,
   although it would be obnoxious for people that are affected by it
   and best avoided.

Change-Id: I0d74820f399044c6f80148bf3022d07d7bf6f4e5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32114
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-08-05 00:38:25 +00:00
Giacomo Travaglini
a1b6471fe5 scons: Add MARSHAL_XXFLAGS_EXTRA for the marshal object
We already provide to the user the CCFLAGS_EXTRA, LDFLAGS_EXTRA
variables to pass flags to scons when compiling/linking gem5.
Those variables are not passed to the marshal object.
We add an extra pair:

MARSHAL_CCFLAGS_EXTRA, MARSHAL_LDFLAGS_EXTRA

to add flag injection capabilities to the marshal object.

The patch is also renaming base_py_env to marshal_env.
This happens for 2 reasons:

1) At the moment the marshal compilation is the only task
making use of the base python environment.

2) Consistency with the EXTRA variable names added with this patch.
I could have named them as BASE_XXFLAGS_EXTRA, but it seems too much
generic and users might be confused by that, as they might think
the BASE_XXFLAGS_EXTRA is a subset of the XXFLAGS_EXTRA so that
setting it will affect gem5 compilation as well.

Change-Id: I3e420caa897059455ff8f35462db2b38da050e93
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30016
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-06-22 09:08:42 +00:00