summaryrefslogtreecommitdiff
path: root/src/SConscript
AgeCommit message (Collapse)Author
2019-05-21scons: Move the marshal binary to the build directoryChun-Chen TK Hsu
The current marshal binary is in $BUILD/python/ directory which makes the dynamic linker fail to find shared libraries with rpath information when the marshal is executing. Moving $BUILD/python/marshal to $BUILD/marshal solves this problem. This is because the marshal binary is built with the same flags as gem5 binary. And if one adds rpath information with add_local_rpath() in some SConscripts, the marshal binary will also link to those shared libraries and have the same rpath information. So it must be in the same directory as gem5 binary such that the dynamic linker could find those shared libraries with the rpath information. Signed-off-by: Chun-Chen TK Hsu Change-Id: I98d9c3e0180abefe6b2b6a78ee5a96324038eb53 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18888 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
2019-03-18scons: fix disable_partial logic for fast binaryHoa Nguyen
Partial linking should be disabled on darwin; however, the script fails to do so when force_lto is set, which results in gem5 building with fast option fails on macOS. This fix changes disable_partial logic, which should be True once it's True. Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Change-Id: I77d2a4cc4a9bf5c92c800c004eb744bb7081c42e Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/16888 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2019-02-26scons: Marshal Python sources using the same Python as gem5Andreas Sandberg
We currently use the Python version used by scons to marshal Python code. This doesn't work when building gem5 with Python 3 support since scons typically runs in Python 2.7. Add a custom marshal helper that links with the same library as gem5 to generate byte code that is guaranteed to work in gem5's Python interpreter. Change-Id: I665b0f2078726d4c055d74a3e668a580fc613b59 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16422 Reviewed-by: Gabe Black <gabeblack@google.com>
2019-02-22python: Make iterator handling Python 3 compatibleAndreas Sandberg
Many functions that used to return lists (e.g., dict.items()) now return iterators and their iterator counterparts (e.g., dict.iteritems()) have been removed. Switch calls to the Python 2.7 iterator methods to use the Python 3 equivalent and add explicit list conversions where necessary. Change-Id: I0c18114955af8f4932d81fb689a0adb939dafaba Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15992 Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2019-02-21scons: Add a convenience method to set RPATH for local libraries.Gabe Black
When linking in a dynamic library which is in the gem5 build directory, it's useful to set RPATH so that you don't have to set LD_LIBRARY_PATH when you run gem5 so that the dynamic linker can find it. Since it's tricky and not entirely obvious how to set up those paths correctly, this change adds a small convenience function which does that for you. It also handles situations where the same dynamic library may be linked into different binaries in different directories which each need a different relative RPATH. It does that by letting the environment for each binary set a construction variable which says how to get from that particular binary back to the build directory. This helper method then sets RPATH to start at $ORIGIN (the binary), to follow that relative path to the variant build directory, and then the per-library but not per-binary path to the library's directory. This change also adds the -z origin linker flag which makes the linker handle $ORIGIN properly. Change-Id: I45f4d72cd14396a73e0b963cea6a39d9bfb7f984 Reviewed-on: https://gem5-review.googlesource.com/c/16566 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-02-12python: Replace dict.has_key with 'key in dict'Andreas Sandberg
Python 3 has removed dict.has_key in favour of 'key in dict'. Change-Id: I9852a5f57d672bea815308eb647a0ce45624fad5 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15987 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2019-02-11scons: Change an = to a += when accumulating sources from filters.Gabe Black
The loop accidentally used a = when it should have used a +=, meaning only the sources from the final filter would be used. Change-Id: Ie066a5f85696f05d9ad3cf61f928b12deb39475b Reviewed-on: https://gem5-review.googlesource.com/c/16285 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-02-06scons: fix unused auto-generated blob variable in clangCiro Santilli
Since f2bda876f73af4ecc38406f3562a3d16fd28a5a9, the build system started adding a length for generated blobs as in: const std::size_t variable_len = 123; There were two types of blob files, ones with a header and the ones without. The ones with the header, also include the header in the .cc of the blob, which contains a declaration: extern const std::size_t variable_len; Therefore, the ones without header, don't have that extern declaration, which makes them static according to the C++ standard. clang then correctly interprets that as problematic due to -Wunused-const-variable, while GCC does not notice this. This patch removes the length declaration from the blob files that don't have the header. Those files currently don't use the length. Change-Id: I3fc61b28f887fc1015288857328ead2f3b34c6e6 Reviewed-on: https://gem5-review.googlesource.com/c/15955 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2019-01-22scons: add helpers to access GDB XML description filesCiro Santilli
Change-Id: Ic3b18887544b7710ed07a86d28dc62d8441b3476 Reviewed-on: https://gem5-review.googlesource.com/c/15255 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-01-22scons: allow embedding arbitrary blobs into the gem5 executableCiro Santilli
The initial motivation for this is to embed the GDB XML target description files into the executable. Change-Id: I721e8dd37119d8e6eb376d7e9050b1094282bacc Reviewed-on: https://gem5-review.googlesource.com/c/15136 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2019-01-07scons: Disable partial linking on Mac OSNikos Nikoleris
Up until Apple LLVM version 10.0.0 (clang-1000.11.45.5), partial linked objects do not expose symbols that are marked with the hidden visibility and consequently building gem5 on Mac OS fails. As a workaround, we disable partial linking, however, we may want to revisit in the future. Change-Id: I0a26dae082bf723c2bd49d90e4497e44ecab9c41 Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15235 Reviewed-by: Andrea Mondelli <andrea.mondelli@ucf.edu> Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-06-26scons: Generalize building binaries.Gabe Black
Building gem5 binaries or regression test binaries needs to be done from within the make_env function which builds an environment for each flavor of build (opt, fast, debug, etc.). That makes it impossible to add new types of binaries without modifying the central SConscript. This change refactors how binaries are set up so that the class that represents them handles the details of how the binary should be built. Also, a metaclass and some lists track types of binaries and individual instances of binaries so that they can be iterated over automatically in make_env. Each new executable class can define a declare_all class function which calls declare() on individual instances. declare_all is a place to do any processing that only has to happen once (for instance specializing the environment) for a particular family of executables. Change-Id: I8a6ee9438280cd67e6c0b92ca28738a53cb16950 Reviewed-on: https://gem5-review.googlesource.com/10915 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2018-06-13tests: Make "UnitTest"s more like GTest so they can be in other dirs.Gabe Black
The original implementation of UnitTest forced all the output binaries to live in the unittest directory, effectively forcing a flat namespace, and seperating the tests from the things they were supposed to be testing. This changes makes them work more like the newer GTest tests in that they can be based out of whatever directory makes sense, although they're currently all still in unittest for the time being. This change also gets rid of automatically tagging the sources associated with a test with the tests name. The first reason for that was that this also forced a flat namespace, since the tests names didn't have any reference to the test's path. Second, this way of pulling in additional files wasn't necessary any more, now that the UnitTest sources could be source filters like they can be for GTests. Change-Id: I3d96ed766ac5170842dbd6daee39f2873bcd6c75 Reviewed-on: https://gem5-review.googlesource.com/10701 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2018-03-06scons: Switch from the print statement to the print function.Gabe Black
Starting with version 3, scons imposes using the print function instead of the print statement in code it processes. To get things building again, this change moves all python code within gem5 to use the function version. Another change by another author separately made this same change to the site_tools and site_init.py files. Change-Id: I2de7dc3b1be756baad6f60574c47c8b7e80ea3b0 Reviewed-on: https://gem5-review.googlesource.com/8761 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-13scons, tests: Fix occasional linking errorAndreas Sandberg
There are some cases where scons incorrectly adds the same object multiple times to the linker command line. This seems to be caused by the test's source list being updated in place when determining test framework dependencies. Fix this by explicitly copying the source list and manipulate the copy. Without this change, the following command fails: scons ./build/ARM/unittests.opt/base/pixeltest.xml Whereas this command succeeds: scons ./build/ARM/base/pixeltest.opt Change-Id: I642efdf9d62a5478e49ba51efe1a3a5ba453e21f Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jack Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/6641 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Gabe Black <gabeblack@google.com>
2017-12-13scons, tests: Add support for GTest XML generationAndreas Sandberg
The GTest framework supports result generation in XML (JUnit). Enable this by creating unit test specific targets in the build/${BUILD_OPTS}/unittests.${VARIANT} directory. Targets in the directory use the following naming convention: ${SRC_PATH}/${TEST_NAME}.xml For example, the opt version of the bitunion test built for ARM would have this path: build/ARM/unittests.opt/base/bituniontest.xml Change-Id: I174dff16817734db05b08ce1d5bcf52e8697bbac Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jack Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/6624 Reviewed-by: Gabe Black <gabeblack@google.com>
2017-12-13scons: Make sure GTests have the right environment variablesAndreas Sandberg
SCons currently scrubs the environment variables used by GTests too aggressively. This breaks systems where libraries are installed in non-standard locations that need to be specified in LD_LIBRARY_PATH. Run said tests in the gtest_env SCons environment which white-lists the important environment variables. Change-Id: I5fc8fb5e51f09644dc976ee97b21c78ab349bf7d Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jack Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/6623 Reviewed-by: Gabe Black <gabeblack@google.com>
2017-12-07tests: Accept SourceFilters as sources for GTest.Gabe Black
This change introduces the idea of a SourceFilter which is an object that can filter a SourceList and which can be composed with other SourceFilters using | and & operators. This means a filter can be constructed ahead of time, possibly before all sources have been discovered, and then later applied to any SourceList necessary. This change also modifies GTest so that it accepts SourceFilters in addition to normal source files. These filters will be applied to the final list of all sources, and the result included in the build for that test. By default, gtests will build in all sources tagged with 'gtest lib'. This change also introduces the keyword argument "skip_lib" which will exclude those files. They can then be left out entirely, or they can be re-included as part of a more elaborate filter. That would be useful if someone wanted to write a unit test for, for instance, the warn, etc. macros which rely on the gtest logging support. Those classes could be replaced by something under the control of the unit test, while still including the rest of the gtest library. Change-Id: I13a846dc884b86b9fdcaf809edefd57bb4168b8e Reviewed-on: https://gem5-review.googlesource.com/6262 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-12-07tests: Add a pseudo target to run all the unit tests for build/variant.Gabe Black
Telling scons to build build/${BUILD_OPTS}/unittests.${VARIANT} will get it to build and run all googletest based unit tests under the ${BUILD_OPTS} build options (ARM, ALPHA, X86, etc.), and compiled with the flags, etc., for the ${VARIANT} variant (ie. opt, debug, etc.). This will make it easy to run the unit tests without having to actually know where they are, what tests are available, etc. This target is called unittests* and not something based on gtest or googletest since it's my intention for all unit tests to be based on googletest, making the distinction unnecessary. Since the target is essentially part of the external interface for scons, I wanted to name it something general so it'll be less likely that we have to change it. Change-Id: I8fdec768d821974309c92a2ce4c96dce7df24fa5 Reviewed-on: https://gem5-review.googlesource.com/6282 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-06scons: Several fixes having to do with tags and sets.Gabe Black
There were a few places where tags weren't being converted to sets correctly which unfortunately only manifested when called in certain ways. This would be a pretty reasonable place to add some python unit tests... Change-Id: I87509369b4ec6f702b7521e52bf63701a87ec436 Reviewed-on: https://gem5-review.googlesource.com/6261 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-12-06scons: Track and reuse object nodes for a given source file.Gabe Black
scons gets upset if two different environments are used to set up a particular object file. This change adds two dicts to the SourceFile class, one for static and one for shared object files, which are keyed off of the appropriate suffix. If a suffix hasn't been set up yet, a new node of the appropriate type is set up and stored in the cache, and then whatever is in the cache (new or old) is returned. Change-Id: Ice4b4fc728b438a4d3316c3ff6667c0480d2a6d7 Reviewed-on: https://gem5-review.googlesource.com/6224 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-11-28scons: Build GTests in the directory they're declared.Gabe Black
This will let us move unit tests into the directory of the code they're testing. Change-Id: I611582eb00a06a848f3ce7da89f64e42660cb844 Reviewed-on: https://gem5-review.googlesource.com/6141 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-28scons: Add in a new type of unit test called GTest.Gabe Black
This type of unit test is almost the same as UnitTest, except that it builds in the googletest library with the appropriate flags, and it also omits all the gem5 object files by default. Change-Id: I230db7ede563a73a9da0ebeed44aca389f724465 Reviewed-on: https://gem5-review.googlesource.com/6084 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-28scons: Minor cleanup of how partial linking is handled in makeEnv.Gabe Black
Git rid of the unused partial_objs variable, and change append to extend since the result of builders is a list of nodes and not individual nodes, even if there's only one target. Change-Id: Ie51225d3ea699eb7da18199ac3bf3e868e3994a6 Reviewed-on: https://gem5-review.googlesource.com/5985 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-27scons: Break make_obj into make_static and make_shared functions.Gabe Black
The make_obj function took a boolean value which just selected which of the two lines it in would actually do something. This change breaks it into two lambdas, make_static and make_shared, which just do whichever line would have been requested, making the funciton name more self descriptive and getting rid of the generally unnamed and opaque boolean argument. Change-Id: I457e40034b7e7f5a3e7294a8e1f15bbd42e0720e Reviewed-on: https://gem5-review.googlesource.com/5984 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-27scons: Remove the extra_deps option from the helper function make_obj.Gabe Black
This had only one use, and made the function more complicated than it needed to be. Change-Id: I22147a0c1239b457c577a6a24b423065e539833b Reviewed-on: https://gem5-review.googlesource.com/5983 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-27scons: Get rid of a flag which makes Werror optional.Gabe Black
This flag wasn't being used. Also move the Werror code to the SConstruct now that it's being applied universally. Change-Id: I18b00d4b41bc1add9271ca299c020c14970a6926 Reviewed-on: https://gem5-review.googlesource.com/5982 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-27scons: Move some compiler flag setting code to the SConstruct.Gabe Black
These settings are invariant, so there's no reason to apply them over and over again for the child environments used for various build products. Change-Id: Icb4053105e4f1c43008f2422ba30c7206b7ff365 Reviewed-on: https://gem5-review.googlesource.com/5981 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-27scons: Get rid of SourceFile's done function.Gabe Black
This function doesn't seem to be used by anything. A similar one off mechanism exists for SimObjects which is we might also be able to get rid of. Change-Id: I65038c3495fa69cf94042dc78f09876d5e9a557f Reviewed-on: https://gem5-review.googlesource.com/5841 Maintainer: Gabe Black <gabeblack@google.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-11-27scons: Switch from "guards" to "tags" on source files.Gabe Black
Tags are just arbitrary strings which are attached to source files which mark them as having some property. By default, all source files have the "gem5 lib" tag added to them which marks them as part of the gem5 library, the primary component of the gem5 binary but also a seperable component for use in, for example, system C. The tags can be completely overridden by setting the "tags" parameter on Source, etc., functions, and can be augmented by setting "add_tags" which are tags that will be added, or alternatively additional tags. It's possible to specify both, in which case the tags will be set to the union of tags and add_tags. add_tags is supposed to be a way to add extra tags to the default without actually overriding the default. Both tags and add_tags can be a list/tuple/etc of tags, or a single string which will be converted into a set internally. Other existing tags include: 1. "python" for files that need or are used with python and are excluded when the --without-python option is set 2. "main" for the file(s) which implement the gem5 binary's main function. 3. The name of a unit test to group its files together. 4. Tags which group source files for partial linking. By grouping the "tags" into a single parameter instead of taking all extra parameters as tags, the extra parameters can, in the future, be passed to the underlying scons environment. Also, the tags are either present or not. With guards, they could be present and True, present and False, or not present at all. Change-Id: I6d0404211a393968df66f7eddfe019897b6573a2 Reviewed-on: https://gem5-review.googlesource.com/5822 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-11-10scons: Move Transform and termcap functionality into their own files.Gabe Black
Change-Id: Ica08e93f3873a7eafd02fe7d44c3bdbf0ce7f6b7 Reviewed-on: https://gem5-review.googlesource.com/5565 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-10-19scons: Fix the regression tests.Gabe Black
A recent scons cleanup introduced a small bug when setting the variant path of the regression test SConscript. When turned into a relative path, the directory can be interpreted differently depending on what it's considered relative to. When left as a scons node, there is no ambiguity. Change-Id: I162afdc4fcef81db096ec8304f81bc98fa6bf899 Reviewed-on: https://gem5-review.googlesource.com/5221 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-10-17scons: Stop generating inc.d in the isa parser.Gabe Black
Generating dependency/build product information in the isa parser breaks scons idea of how a build is supposed to work. Arm twisting it into working forced a lot of false dependencies which slowed down the build. Change-Id: Iadee8c930fd7c80136d200d69870df7672a6b3ca Reviewed-on: https://gem5-review.googlesource.com/5081 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
2017-06-06scons: Try to handle problems with gcc, lto and partial linking.Gabe Black
gcc has had a lot of problems with incremental linking and partial linking at the same time. Basically, the partial link assumes that it's the only link that's going to happen, and it converts weak external symbols into regular external symbols. Then when the real final link happens, those symbols are duplicated and the link fails. Versions of gcc 6 and greater add an option called -flinker-output which lets you tell the linker to do an incremental link. Unfortunately, other bugs make that fail, and so gcc 6 doesn't work either. Hopefully version 7 works better. A --force-lto option was added so that, when only one of lto and partial linking is available, you can switch from having partial linking to having lto. Change-Id: I5e293f5cfb07a14343dc74030d99cb161fb8bbbe Reviewed-on: https://gem5-review.googlesource.com/3680 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2017-05-08scons: Get rid of the PHONY_BASE construction variable.Gabe Black
The value of that variable can be computed more directly and more locally to where it's consumed. Change-Id: I5ca1f732a34e22d4dae2aeb6ee7fc8adebe1caa0 Reviewed-on: https://gem5-review.googlesource.com/2981 Maintainer: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-08scons: Replace str(foo.get_contents()) with foo.get_text_contents().Gabe Black
For Value() nodes, the get_contents() method and the get_text_contents() method are just aliases to the same thing, both of which return a value which has already been converted using str(). The str() which was included explicitly in the SConscript was redundant, except that it showed that the value from get_contents was being treated as a string. To avoid the redundancy but to still leave a hint to the value's type, this change converts those bits of code to use get_text_contents() and removes the str(). Change-Id: I8f7da9b652f749e741b553c9a0e2248ae15ec3ca Reviewed-on: https://gem5-review.googlesource.com/3084 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-08scons: Make env['USE_PYTHON'] a source for createEnumStrings.Gabe Black
That clues scons in to the fact that the contents of the target of that function depends on the value of that construction variable. Change-Id: I803322ea1a178152da3d95dffffe20acd4271c88 Reviewed-on: https://gem5-review.googlesource.com/3083 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Paul Rosenfeld <prosenfeld@micron.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-03scons: Merge reading test SConscripts into makeEnv.Gabe Black
We're already visiting each of the environments, there's no reason to track them all and then set up test SConscripts on a second pass. Change-Id: I2d1166f58ac907e874d6ad5de7bd53ff7ad645f8 Reviewed-on: https://gem5-review.googlesource.com/2980 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-02python: Use PyBind11 instead of SWIG for Python wrappersAndreas Sandberg
Use the PyBind11 wrapping infrastructure instead of SWIG to generate wrappers for functionality that needs to be exported to Python. This has several benefits: * PyBind11 can be redistributed with gem5, which means that we have full control of the version used. This avoid a large number of hard-to-debug SWIG issues we have seen in the past. * PyBind11 doesn't rely on a custom C++ parser, instead it relies on wrappers being explicitly declared in C++. The leads to slightly more boiler-plate code in manually created wrappers, but doesn't doesn't increase the overall code size. A big benefit is that this avoids strange compilation errors when SWIG doesn't understand modern language features. * Unlike SWIG, there is no risk that the wrapper code incorporates incorrect type casts (this has happened on numerous occasions in the past) since these will result in compile-time errors. As a part of this change, the mechanism to define exported methods has been redesigned slightly. New methods can be exported either by declaring them in the SimObject declaration and decorating them with the cxxMethod decorator or by adding an instance of PyBindMethod/PyBindProperty to the cxx_exports class variable. The decorator has the added benefit of making it possible to add a docstring and naming the method's parameters. The new wrappers have the following known issues: * Global events can't be memory managed correctly. This was the case in SWIG as well. Change-Id: I88c5a95b6cf6c32fa9e1ad31dfc08b2e8199a763 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Andreas Hansson <andreas.hansson@arm.com> Reviewed-by: Andrew Bardsley <andrew.bardsley@arm.com> Reviewed-on: https://gem5-review.googlesource.com/2231 Reviewed-by: Tony Gutierrez <anthony.gutierrez@amd.com> Reviewed-by: Pierre-Yves Péneau <pierre-yves.peneau@lirmm.fr> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2017-05-01scons: Remove the SPAWN hack added earlier.Gabe Black
A previous change forced scons to spawn child processes by exec-ing it directly rather than going through the shell because the command line length would be too long for the shell to handle. Now that incremental linking should keep the command line lengths more under control, that change should no longer be necessary. Change-Id: I9e82a62083afd1414324a7fd697bd6d4b76367ae Reviewed-on: https://gem5-review.googlesource.com/2947 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-01scons: Group Source-s based on what SConscript included them.Gabe Black
The groups won't be perfectly balanced or optimally planned, but this requires no thought and breaks the object files down into a reasonable number of reasonably sized groups. Change-Id: I6542fc807aaf356a9be751093f68e2e29f0b1586 Reviewed-on: https://gem5-review.googlesource.com/2946 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-05-01scons: Put Source objects in groups and partially link them.Gabe Black
The groups will be linked together into intermediate partially linked object files. Right now the hierarchy is assumed to be flat, but with some effort it could be extended to allow truly hierarchical linking. Change-Id: I77b77710554e5f05e8b00720a0170afaf4afac2d Reviewed-on: https://gem5-review.googlesource.com/2945 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
2017-04-14scons: When spawning the linker process, don't involve the shell.Gabe Black
The command line can be too long, causing bash to choke. This means we can't use any shell syntax like shell variables or redirection when linking, but that should be easy to avoid. Change-Id: Ie6c8ecab337cef6bd3c7e403346ced06f46f0993 Reviewed-on: https://gem5-review.googlesource.com/2780 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Steve Reinhardt <stever@gmail.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
2017-01-27python: Move native wrappers to the _m5 namespaceAndreas Sandberg
Swig wrappers for native objects currently share the _m5.internal name space with Python code. This is undesirable if we ever want to switch from Swig to some other framework for native binding (e.g., PyBind11 or Boost::Python). This changeset moves all of such wrappers to the _m5 namespace, which is now reserved for native code. Change-Id: I2d2bc12dbc05b57b7c5a75f072e08124413d77f3 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
2016-11-28scons: fix sanitizer flags with multiple sanitizersJoe Gross
There has been some problem when using address and undefined-behavior sanitizers at the same time. This patch will look for the special case where both are enabled at once and change the flags passed to the compiler to reflect this.
2016-06-28scons: Track swig packages when loading embedded swig codeAndreas Hansson
This patch changes how the embedded swig code is loaded to ensure that gem5 works with swig 3.0.9. For Python 2.7 and above, swig 3.0.9 now relies on importlib, and actually looks in the appropriate packages, even for the wrapped C code. However, the swig wrapper does not explicitly place the module in the right package (it just calls Py_InitModule), and we have to take explicit action to ensure that the swig code can be loaded. This patch adds the information to the generated wrappers and the appropriate calls to set the context as part of the swig initialisation. Previous versions of swig used to fall back on looking in the global namespace for the wrappers (and still do for Python 2.6), but technically things should not work without the functionality in this patch.
2016-05-30scons: Bump minimum gcc version to 4.8Andreas Hansson
After reaching consensus on the mailing list, this patch officially makes gcc 4.8 the minimum. A few checks in the SConstruct are cleaned up as a result. This patch also adds "-fno-omit-frame-pointer" when using ASAN (which is part of the gcc/clang recommended flags).
2016-03-13scons: fix building in non-standard locationsSteve Reinhardt
It's apparently not widely known that our scons scripts allow you to put the build directory wherever you want; not only does it not have to be immediately under the root of your repo, it doesn't even have to be underneath the root at all. (For example, sometimes it's useful to build on a local disk if your repo is on a slow NFS mount.) I point this out because this functionality has been broken for close to two years but no one seems to have noticed yet. This patch fixes an assumption that crept in in changeset be0e1724eb39 (May 09 2014) that the build dir would be immediately under the top level of the repo, preventing builds anywhere else.
2016-02-17scons: Enable building with the gcc/clang Address SanitizerAndreas Hansson
Allow the user to easily build gem5 with the Address Sanitizer, part of both gcc and clang these days.
2016-02-08scons: always generate sim/tags.ccCurtis Dunham
Due to insufficient build deps, the checkpoint tags might not get updated; this commit solves this. Due to the uncommon nature of the build target, regenerating tags.cc is a fairly clean solution. Since SCons hashes file contents, it won't recompile anything unless a new checkpoint upgrader is actually added. --HG-- extra : amend_source : ed3879da7668554693f697076deaf5029cc9b954