Commit Graph

448 Commits

Author SHA1 Message Date
Bobby R. Bruce
26ba6dad80 scons: Remove warn as error for v24.1 2024-12-06 19:45:58 -08:00
Bobby R. Bruce
8b30d848e9 scons: Setup scons for gem5 only supporting gcc >=10
Change-Id: I66f83498a38def3d00d1c9e981aa90706ee20bbb
2024-05-20 07:05:08 -07:00
Bobby R. Bruce
be00691cd3 scons: Disable Address Sanitizer for GCC (#951)
This removes the '--with-asan' as it's are not compatible with GCC. The
`--with-asan` incompatibility with GCC is discussed in Issue #916.
2024-04-04 11:48:34 -07:00
Alexander Richardson
e7d7199ea4 scons: Add option to use libc++ (#680)
this adds an option --with-libcxx, that adds the -stdlib=libc++ flag to
link against libc++ instead of libstdc++ on Linux. Currently this is
only possible with clang and may not work with all build configurations
(e.g. protobuf linked against libstdc++), so this needs to be opt-in
rather than being on by default for clang whenever libc++ is detected.

Change-Id: Ib4022a58bb2dbd32417c58f01c7443a02ff710fe
2023-12-28 12:49:44 -08:00
Bobby R. Bruce
7c882e17db scons: Re-enable warnings-as-errors for develop branch
Change-Id: I9c9898395858bad7365b36779b71d07f847bed70
2023-12-27 11:48:16 -08:00
Bobby R. Bruce
2134ec5163 scons: Remove warnings-as-errors comp feature for v23.1
Change-Id: Iae1981e06cd98aa12e1e2362487e36388602dc7b
2023-12-21 19:15:51 -08:00
Hoa Nguyen
1d1cba297b scons: Add an option to reduce memory usage of ld (#601)
Linking the gem5 binary consists of linking numerous object files. By
default, ld optimizes for speed over for memory consumption [1]. This
leads to the huge memory consumption of gem5 at the linking stage.

This patch adds an option to add the `--no-keep-memory` flag to ld.
According to the documentation [1], this flag optimizes the memory usage
of ld.

[1]
https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_chapter/ld_2.html#IDX133

Signed-off-by: Hoa Nguyen <hn@hnpl.org>
2023-11-29 14:24:48 -08:00
Roger Chang
3b06925408 scons: Update Kconfig description
Change-Id: I69206fb9881bc0d53660bbd1cf8fc225ead9fea3
2023-11-23 08:26:11 +08:00
Gabe Black
d37673be9f scons: Remove the default-default build target.
In gem5, there are many equally valid and equally useful top level
targets which the user might want. It no longer makes sense to
arbitrarily pick one to be the default target. It makes sense to force
the user to actually specify what they want, instead of assuming it
must be the ARM debug binary.

There is currently an M5_DEFAULT_BINARY environment variable which
will change what the default binary is, if set. This change leaves
that in place, but removes the default-default, or in other words the
default that is used if M5_DEFAULT_BINARY is not set.

This way if the user knows what default they want, they can specify it
locally in their environment and avoid having to type it over and over
again, but we're not making an arbitrary choice at a more global level
without the context to know what actually makes sense.

Change-Id: I886adb1289b9879d53387250f950909a4809ed8b
2023-11-23 08:26:11 +08:00
Gabe Black
63919f6a68 scons: Hook up oldconfig and olddefconfig.
These two utilities help update an old config to add settings for new
config options. The difference between them is that oldconfig asks what
new settings you want to use, while olddefconfig automatically picks the
defaults.

Change-Id: Icd3e57f834684e620705beb884faa5b6e2cc7baa
2023-11-23 08:26:11 +08:00
Gabe Black
ec76214f68 scons: Hook up the savedefconfig kconfig helper.
This helper utility lets you save the defconfig which would give rise to
a given config. For instance, you could use menuconfig to set up a
config how you want it with the options you cared about configured, and
then use savedefconfig to save a defconfig of that somewhere to the
side, in the gem5 defconfig directory, etc. Then later, you could use
that defconfig to set up a new build directory with that same config,
even if the kconfig options have changed a little bit since then.

A saved defconfig like that can also be a good way to visually see what
options have been set to something interesting, and an easier way to
pass a config to someone else to use, to put in bug reports, etc.

Change-Id: Ifd344278638c59b48c261b36058832034c009c78
2023-11-23 08:26:11 +08:00
Gabe Black
51b8cfcede scons: Hook up the kconfig guiconfig program.
Change-Id: I0563a2fb2d79cea5974aeaf65a400be5ee51dc63
2023-11-23 08:26:11 +08:00
Gabe Black
91b3da016b scons: Hook in the listnewconfig kconfig helper.
This helper lists config options which are new in the Kconfig and which
are not currently set in the config file.

Change-Id: I0c426d85c0cf0d2bdbac599845669165285a82a0
2023-11-23 08:26:11 +08:00
Gabe Black
083bca1e23 scons: Hook in the kconfig setconfig utility.
This little utility lets you set particular values in an existing config
without having to open up the whole menuconfig interface.

Also reorganize things in kconfig.py a little to help share code between
wrappers.

Change-Id: I7cba0c0ef8d318d6c39e49c779ebb2bbdc3d94c8
2023-11-23 08:26:11 +08:00
Gabe Black
1ae2dfcc56 scons: Add a mechanism to manually defconfig a build dir.
This will let you specify *any* defconfig file, instead of implicitly
selecting one from the defconfig directory based on the variant name.

Change-Id: I74c981b206849f08e60c2df702c06534c670cc7c
2023-11-23 08:26:11 +08:00
Gabe Black
1e84d9f941 scons: Add a mechanism to run menuconfig to set up a build dir.
If you call scons with the fist argument set to menuconfig, that means
to run menuconfig on the path following it. Or in other words, if
you ran this command:

scons menuconfig build/foo/bar

That would tell SCons to set up a build directory at the path
build/foo/bar, and then invoke menuconfig so you can set up its
configuration.

In addition to using this mechanism to set up a new build directory, you
can also use it to reconfigure an existing directory.

This supplements and does not replace the existing mechanism of using
"build/${VARIANT}" to select a config with defconfig.

Change-Id: Ief8e8c2ee6477799455c2004bef06c64be5cc1db
2023-11-23 08:26:11 +08:00
Gabe Black
f4c578f458 scons: Flesh out the help text for "magic" targets.
These targets are not necessarily obvious, and tell SCons to do useful
things, like build a particular version of the gem5 binary with a
particular configuration, or run the unit tests.

Add descriptions of these targets to the help so that they are much
more discoverable.

Change-Id: If84399be1a7155ff5f66f511efe1f1c241089c84
2023-11-23 08:26:10 +08:00
Gabe Black
db3a6e8e84 scons: Use Kconfig to configure gem5.
These are not yet consumed by anything, but convert all the settings
from SCons variables to Kconfig variables.

If you have existing SConsopts files which need to be converted, you
should take a look at KCONFIG.md to learn about how kconfig is used in
gem5. You should decide if any variables need to be available to C++ or
kconfig itself, and whether those are options which should be detected
automatically, or should be up to the user. Options which should be
measured automatically should still be in SConsopts files, while user
facing options should be added to new or existing Kconfig files.

Generally, make sure you're storing c++/kconfig visible options in
env['CONF'][...]. Also remove references to sticky_vars since persistent
options should now be handled with kconfig, and export_vars since
everything in env['CONF'] is now exported automatically.

Switch SCons/gem5 to use Kconfig for configuration, except EXTRAS which
is still a sticky SCons variable. This is necessary because EXTRAS also
controls what config options exist. If it came from Kconfig itself, then
there would be a circular dependency. This dependency could
theoretically be handled by reparsing the Kconfig when EXTRAS
directories were added or removed, but that would be complicated, and
isn't supported by kconfiglib. It wouldn't be worth the significant
effort it would take to add it, just to use Kconfig more purely.

Change-Id: I29ab1940b2d7b0e6635a490452d05befe5b4a2c9
2023-11-23 08:26:10 +08:00
Gabe Black
5f73a9bbf0 scons: Use either the "build" or "gem5.build" as build anchor.
If gem5.build already exists within a directory, then that build
directory can be used without having to worry about variants.

If it doesn't exist and we find a build/${VARIANT} style path, then we
use that as the anchor.

In either case, the variant name is the final component of the build
path. The parse_build_path function had been separating that out, but it
was just put back onto the path again anyway by the only caller, and
then split out again when that path was consumed. We save a step by not
splitting it out in parse_build_path.

Change-Id: I8705b3dbb7664748f5525869cb188df70319d403
2023-11-23 08:26:10 +08:00
Roger Chang
1a7014c653 scons: Explicit the config option HAVE_PKG_CONFIG type boolean
The scons function Detect will return the program name if the program
is exists in the system. However, the HAVE_PKG_CONFIG is used to
check the pkg-config program is exists and it should be the boolean
type.

Change-Id: I18c4813d36eea68b8851a41db41777bdb2a80b7b
2023-10-20 11:42:20 +08:00
Bobby R. Bruce
d463f73a43 scons: Revert "Add an option specifying the..."
Change-Id: I2bd952d3cfd6c3c671b5ab3458e44c53f93bf649
2023-09-13 14:28:05 -07:00
Bobby R. Bruce
ce54ff061a scons: Fix 'recompiling' -> 'recompile'
Change-Id: Ifb2366a0c2342bf4e7207df8db6196e14184a9d5
2023-09-07 12:52:31 -07:00
Hoa Nguyen
73b0e88d6e scons: Add an option specifying the path to mold linker binary
To use mold linker with gcc of version older than 12.1.0, the user
has to pass the -B option to specify where the linker is. [1]

Currently in gem5, scons only looks for the mold binary at
conventional places, such as /usr/libexec/mold and
/usr/local/libexec/mold. There's no option to manually specify
the path to the linker.

gcc-12 and mold are not widely available on older systems. Having
an option to manually input the mold linker path allows users to use
built mold instances anywhere on the system, not just the default
locations in /usr where they may not have permission to install mold
(i.e., no sudo permissions).

[1] https://github.com/rui314/mold#how-to-use

Change-Id: Ifb2366a0c2342bf4e7207df8db6196e14184a9d4
Signed-off-by: Hoa Nguyen <hn@hnpl.org>
2023-09-01 00:31:28 -07:00
Gabriel Busnot
2a880053bb Sanitizer libraries static linking (#70)
* scons: Fix sanitizer lib link for clang

Change-Id: I2441466c5c9343afd938185b8ec5047d4e95ac70

* scons: Statically link libubsan when using sanitizers with gcc

Change-Id: I362a1fb87771454ad94e439847a85d19108f375a

---------

Co-authored-by: Gabriel Busnot <gabriel.busnot@arteris.com>
2023-07-12 11:24:18 -07:00
Bobby R. Bruce
4f45f84aa5 misc: Revert remove -Werror
This reverts commit 6c997b633f.

This is so the develop branch gives warnings as errors.

Change-Id: I6c8c81d478dc11fb561748dd2f392103b2beff68
2023-07-10 12:31:31 -07:00
Bobby R. Bruce
6c997b633f scons: Remove -Werror for the gem5 v23.0 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: Ie32a5c526a17cc584bce3b71d27b8f052caf612b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/72178
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2023-07-07 21:22:26 +00:00
Alex Richardson
fccd13ac85 scons: default to not duplicating sources in the build directory
We now default to --no-duplicate-sources, but keep --duplicate-sources to
opt-out of this new build behaviour in case it introduces regressions.

Change-Id: I2f01ceaef7b6b9bff80f4402081f007110f7e6f3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68758
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2023-05-17 17:49:48 +00:00
Richard Cooper
aff1bfe491 scons: Fix gem5 Python3.11 build.
The code generation in gem5's build system requires the use of Regular
Expression flags when defining the regular expressions used for
tokenization. However, the Python Lex-Yacc (PLY) [1] library used by
gem5 does not allow the user sufficient control of the flags for RE
compilation.

Previously, gem5 used inline RE flags to control RE compilation.
However, from Python 3.11, inline RE flags must be at the start of the
RE string. Because PLY wraps the user supplied RE strings before
compilation, there is no way for the user to supply a RE string with
the inline flag at the start. This makes gem5 incompatible with Python
3.11 when using PLY.

This change modifies gem5's build files to patch `re.compile` with a
wrapped version that can handle embedded flags anywhere in the RE
string, for all current versions of Python. The patched version
re-formats the user supplied RE string to convert inline RE flags to
explicit RE flags.

This patch is intended as a temporary stop-gap until PLY can be fixed
upstream.

See the gem5 Issue Tracker [2] for more details.

[1] https://github.com/dabeaz/ply
[2] https://gem5.atlassian.net/browse/GEM5-1321

Change-Id: I3ab371f2e5cf267c0a89caaf8a2bacfed78545ef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70237
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Boris Shingarov <shingarov@labware.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2023-05-05 07:36:36 +00:00
Melissa Jost
912795afd3 scons: Add stdc++fs and libc++experimental for clang LIBS env
This change fixes a failure in the compiler tests:
https://jenkins.gem5.org/job/compiler-checks/573/

These tests were failing due to the use of `std::filesystem`, which
requires 'stdc++fs' to be linked for clang versions 6
through 10.

Change-Id: I4fa03923e8dc616046dead939c77d49b301de36b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69777
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2023-04-24 23:30:01 +00:00
Bobby R. Bruce
640891ac41 scons: Fix "no-duplicate-sources" to include .hh when not set
A flag, introduced in this patch:
https://gem5-review.googlesource.com/c/public/gem5/+/68518
allowed users to pass "no-duplicate-sources" to a gem5 compilation to
not symlink sources in the build directory.

In this patch "src" was added as a shared top-level header directory.
This means that the header files are not copied to the "build" directory
whether or not "no-duplicate-sources" is set.

This patch ensures the "src" directory is only added as a shared
top-level headers directory in the case where "no-duplicate-sources" is
set.

In addition, the "duplicate_sources" parameter (the destination for the
"no-duplicate-sources") was "None" by default, and only set to False
when the flag was used. `default=True` has been added so
"duplicate_sources" can be used as a boolean.

This bug was a cause of a Nightly build error:
https://jenkins.gem5.org/job/nightly/570

In this error, building ext/sst resulted in an error as the Makefile
depends on adding "build/RISCV" to the include path. Without the header
files in the "build" directory, building SST failed. Though, ext/stt
should probably not be using header files in the "build/RISCV"
directory. This will be fixed in another change.

Change-Id: I786486a177fe17a67f3b939c539eecdcbfcaeaf2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69717
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2023-04-13 17:19:06 +00:00
Bobby R. Bruce
1258f481c9 scons: Add '-lstdc++fs' to LIBS env when GCC version < 9
This commit is in response to a failure in the compiler tests:
https://jenkins.gem5.org/job/compiler-checks/570/

GCC versions <9 failed to compile gem5 with the following error:

```
socket.cc:(.text+0x32d5): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
socket.cc:(.text+0x32e5): undefined reference to `std::filesystem::create_directory(std::filesystem::__cxx11::path const&, std::error_code&)'
socket.cc:(.text+0x3370): undefined reference to `std::filesystem::current_path[abi:cxx11](std::error_code&)'
socket.cc:(.text+0x33cc): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
socket.cc:(.text+0x33d7): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&, std::error_code&)'
socket.cc:(.text+0x3468): undefined reference to `std::filesystem::current_path(std::filesystem::__cxx11::path const&, std::error_code&)'
```

This was due to this patch:
https://gem5-review.googlesource.com/c/public/gem5/+/69164 which
utilized `std::filesystem`. Prior to to GCC v9, explicit linking with
the stdc++fs library is required due to `std::filesystem` being an
experimental implementation prior to GGC v9.

Change-Id: I584e29f100cb59b40bd155c212e1814f6d8fbb99
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69597
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2023-04-11 06:08:23 +00:00
Alex Richardson
5e096f5b5d scons: allow building without duplicating source files
This adds a new scons flag --no-duplicate-sources to build without
linking source files to the build directory.

I find this very helpful when using CLion, since I can now generate a
compilation database using
`bear scons build/ALL/gem5.debug --no-duplicate-sources` and CLion will
now correctly semantically analyze all the files inside src/.
It also ensures that clicking on a build warning/error now opens the
real source file rather than a symlink.

This is not enabled by default since it's possible that certain use
cases are not working correctly, but the basic testing I've done so
far appears to work just fine.

It appears that with this change the `<root>/src` directory is no longer
added to `PYTHONPATH` when running `tests/main.py`, so this change
depends on https://gem5-review.git.corp.google.com/c/public/gem5/+/68757

Change-Id: Iddc9bf9c8211e68e5432c0a07f5c95f427c1ca16
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68518
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2023-04-05 22:00:07 +00:00
Gabriel Busnot
13dca0ebcb scons: Link tcmalloc_minimal by default instead of tcmalloc
tcmalloc triggers asan while tcmalloc_minimal does not. The feature
difference is not significant for regular gem5 use.

Jira issue: https://gem5.atlassian.net/browse/GEM5-1312

Change-Id: I410a26d2ecdf422c456d44276d9e7ec60582b8cc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67431
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2023-02-01 09:51:16 +00:00
Johnny
d48e53e0a2 scons: force libasan to static linking
The asan(enable with --with-asan) sanitizer interpret calls to dlopen().
That replaces the RUNPATH of an executable with RUNPATH of libasan.so
after libasan.so is loaded by loader. Then it may cause some shared
libraries missing, i.e. the error messages is like
"cannot open shared object file: No such file or directory" since the
RUNPATH is no longer correct. Force the libasan to static linking
can avoid this issue since libasan.a does not have a RUNPATH, thus
the replacement will never happen.

Change-Id: I8e5ff4d1fbe4644a258054be6e9f6d4db9062e56
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67298
Reviewed-by: Earl Ou <shunhsingou@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2023-01-31 05:59:51 +00:00
Gabriel Busnot
534d9dea10 scons: Raise bin size limit for sanitized builds.
Sanitizers can enlarge binary size drammatically, north of 2GB. This
can prevent successful linkage due to symbol relocation outside from
the 2GB region allocated by the small x86_64 code model that is
enabled by default (32-bit relative offset limitation). Switching to
the medium model in x86_64 enables 64-bit relative offset for large
objects (>64KB by default) while sticking to 32-bit relative
addressing for code and smaller objects. Note this comes at a
potential performance cost so it should not be enabled in all cases.
This should still be a very happy medium for non-perf-critical
sanitized builds.

Jira issue: https://gem5.atlassian.net/browse/GEM5-1313

Change-Id: I9aceacfcda99cc29c8fb24b7c69aaab019ce97fd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67451
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2023-01-25 08:36:39 +00:00
Earl Ou
a2658f08e5 systemc: fix -Wno-free-nonheap-object for building scheduler.cc
-Wno-free-nonheap-object can happen at compile or link time depending on
the versions. To better disable this false alarm, we move the memory
management part into .cc file, so the check is always done at link time.

This change also removes the global flags so other code is still checked
with the flags.

Change-Id: I8f1e20197b25c90b5f439e2ecc474bd99e4f82ed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67237
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
2023-01-13 05:58:51 +00:00
Bobby R. Bruce
28a871b037 scons: Re-add -Werror for gem5 develop branch
This is removed from the stable branch to avoid build errors but should
included on the develop branch to aid developers.

This reverts commit 7dd61c8659.

Change-Id: I1fe249ce87aa8d70c1f092fc7db1554e6aee7355
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67052
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2023-01-03 22:08:08 +00:00
Bobby R. Bruce
7dd61c8659 scons: Remove -Werror for the gem5 v22.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: Ib6d4f86d9c7e60f23eba843e444cdd7812cdde41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65912
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
2022-12-05 20:25:53 +00:00
Hoa Nguyen
6ca1138a31 scons: Fix scons ParseConfig error for SCons versions 4.4+
SCons 4.4 changed the ParseConfig user's function signature [1].
The function is now required to take `unique` as a parameter.

[1] d0106a9967

Change-Id: I3fa9fbf77ff3877187e15c63f5414889a53caefa
Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62091
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
2022-08-05 04:33:39 +00:00
Bobby R. Bruce
687d992ccf misc: Revert "scons: Remove -Werror for the gem5 v22.0 release"
This reverts commit 4df0d886df.
https://gem5-review.googlesource.com/c/public/gem5/+/60510

Change-Id: I0833b210c6dd46f77dc0ca0cc399e013efb2e7ca
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/60638
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
2022-06-20 19:56:24 +00:00
Bobby R. Bruce
4df0d886df scons: Remove -Werror for the gem5 v22.0 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: I0efe6cf83714720ae0d5de9de9b993c6d8ab00a8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/60510
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-17 05:34:13 +00:00
Luming Wang
c376ec2fde scons: support --linker="mold" for gcc < 12.
Now, to use mold linker for gcc prior to version 12.1.0, you need
to manually set the LINKFLAGS_EXTRA scons variable. This is because
older gcc doesn't support "-fuse-ld=mold" option.

To make it more convenient for users, this patch adds support for
'--linker="mold"' option for older versions of gcc. A -B option will
be passed to gcc automatically if '/usr/libexec/mold' or
'/usr/local/libexec/mold' exist.

[1] https://github.com/rui314/mold
[2] https://gem5-review.googlesource.com/c/public/gem5/+/57173

Change-Id: Id1cd780d98c39fc837066d826a9ff942579748fe
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/60109
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
2022-05-31 02:27:57 +00:00
Yu-hsin Wang
7a8af170e3 scons: Fix script failed when default files not found
Change-Id: Ic673783cb5050159a141a869ca17b1ac09a924ef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58809
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-13 01:11:36 +00:00
Gabe Black
c2c9ddaf74 scons: Monkey patch a fix from 3.0.2 into 3.0.0 and 3.0.1.
Ensure that SCons.Subst.Literal can be hashed.

https: //pairlist2.pair.net/pipermail/scons-dev/2018-October/004766.html
Change-Id: I5221b63a5fd63189eb690c77e780805dc6d68125
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58633
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-06 07:38:06 +00:00
Gabe Black
4c6790ada6 scons: Stop the fast model project file parser from writing files.
PLY tries to write these little files into the SCons installation
directory, which it shouldn't even if it was allowed to. This avoids
a bunch of annoying messages about not having enough permission.

Change-Id: Ifd4eda9dd9f8518b3fd075e8a46de1b6c12c2127
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58353
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jui-min Lee <fcrh@google.com>
2022-04-01 02:28:56 +00:00
Gabe Black
964500f363 scons: Put internal build files in a gem5.build directory.
This keeps them organized, and also creates an anchor for the build
directory other than a directory named "build".

Change-Id: I3ed2f569e9fcd62eb4eca1c4556b45cd0c3552d4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56589
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-28 20:31:21 +00:00
Gabe Black
e6c0ba97db scons: Put all config variables in an env['CONF'] sub-dict.
This makes what are configuration and what are internal SCons variables
explicit and separate, and makes it unnecessary to call out what
variables to export to C++.

These variables will also be plumbed into and out of kconfiglib in later
changes.

Change-Id: Iaf5e098d7404af06285c421dbdf8ef4171b3f001
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56892
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-28 20:31:21 +00:00
Gabe Black
8618dd8ae7 scons: Turn all global sticky variables into variant ones.
Saved option files are processed twice, once to load the value of the
EXTRAS variable, and then again once variables have been set up by
SConsopts.

Change-Id: Id8d49051c8fe684142a68259c470ed7c86bdab53
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56753
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-03-16 21:11:48 +00:00
Gabe Black
9d3cd97920 scons: Turn a lot of compiler flag vars into env vars.
These are used to adapt gem5 to the system it's being built on, and so
should be attached to the host via the environment rather than gem5's
configuration.

Change-Id: I2adfe1af484dcdeae32a48097d9aa87752a7ed2a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56752
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2022-03-14 21:06:46 +00:00
Gabe Black
a8602e3b63 scons: Process the SConsopts files for each variant.
The SConsopts files that need to be processed is affected by the EXTRAS
setting, and if all settings are going to be local to the variants, that
means each variant can have a different set of SConsopts files to use.

This does result in Configure type output showing up repeatedly when
building multiple variants, but that's uncommon for users, and will
hopefully become unnecessary for developers over time.

Change-Id: I7df287c37fc32e91576dced80d0a9e56806c4581
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56751
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2022-03-14 21:06:46 +00:00