[gem5-dev] Change in gem5/gem5[develop]: scons: Add MARSHAL_XXFLAGS_EXTRA for the marshal object

2020-06-22 Thread Giacomo Travaglini (Gerrit) via gem5-dev
Giacomo Travaglini has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/30016 )


Change subject: scons: Add MARSHAL_XXFLAGS_EXTRA for the marshal object
..

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 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30016
Reviewed-by: Jason Lowe-Power 
Reviewed-by: Nikos Nikoleris 
Reviewed-by: Andreas Sandberg 
Maintainer: Andreas Sandberg 
Tested-by: kokoro 
---
M SConstruct
M src/SConscript
2 files changed, 8 insertions(+), 4 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, but someone else must approve
  Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/SConstruct b/SConstruct
index 4bc3d0e..b327a8b 100755
--- a/SConstruct
+++ b/SConstruct
@@ -276,6 +276,8 @@
 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
 ('CCFLAGS_EXTRA', 'Extra C and C++ compiler flags', ''),
 ('LDFLAGS_EXTRA', 'Extra linker flags', ''),
+('MARSHAL_CCFLAGS_EXTRA', 'Extra C and C++ marshal compiler  
flags', ''),

+('MARSHAL_LDFLAGS_EXTRA', 'Extra marshal linker flags', ''),
 ('PYTHON_CONFIG', 'Python config binary to use',
  [ 'python2.7-config', 'python-config', 'python3-config' ]),
 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
@@ -734,7 +736,9 @@

 main.Prepend(CPPPATH=Dir('ext/pybind11/include/'))
 # Bare minimum environment that only includes python
-base_py_env = main.Clone()
+marshal_env = main.Clone()
+marshal_env.Append(CCFLAGS='$MARSHAL_CCFLAGS_EXTRA')
+marshal_env.Append(LINKFLAGS='$MARSHAL_LDFLAGS_EXTRA')

 # On Solaris you need to use libsocket for socket ops
 if not  
conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):

@@ -1285,7 +1289,7 @@
 # to the configured variables.  It returns a list of environments,
 # one for each variant build (debug, opt, etc.)
 SConscript('src/SConscript', variant_dir=variant_path,
-   exports=['env', 'base_py_env'])
+   exports=['env', 'marshal_env'])

 # base help text
 Help('''
diff --git a/src/SConscript b/src/SConscript
index 7582510..0b3127f 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1140,7 +1140,7 @@
 # Build a small helper that marshals the Python code using the same
 # version of Python as gem5. This is in an unorthodox location to
 # avoid building it for every variant.
-py_marshal = base_py_env.Program('marshal', 'python/marshal.cc')[0]
+py_marshal = marshal_env.Program('marshal', 'python/marshal.cc')[0]

 # Embed python files.  All .py files that have been indicated by a
 # PySource() call in a SConscript need to be embedded into the M5
@@ -1196,7 +1196,7 @@
 code.write(str(target[0]))

 for source in PySource.all:
-base_py_env.Command(source.cpp, [ py_marshal, source.tnode ],
+marshal_env.Command(source.cpp, [ py_marshal, source.tnode ],
 MakeAction(embedPyFile, Transform("EMBED PY")))
 Source(source.cpp, tags=source.tags, add_tags='python')


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/30016
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3e420caa897059455ff8f35462db2b38da050e93
Gerrit-Change-Number: 30016
Gerrit-PatchSet: 3
Gerrit-Owner: Giacomo Travaglini 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Ciro Santilli 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Nikos Nikoleris 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: scons: Add MARSHAL_XXFLAGS_EXTRA for the marshal object

2020-06-04 Thread Giacomo Travaglini (Gerrit) via gem5-dev
Giacomo Travaglini has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/30016 )



Change subject: scons: Add MARSHAL_XXFLAGS_EXTRA for the marshal object
..

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 
---
M SConstruct
M src/SConscript
2 files changed, 8 insertions(+), 4 deletions(-)



diff --git a/SConstruct b/SConstruct
index 3a03af4..5a66bba 100755
--- a/SConstruct
+++ b/SConstruct
@@ -276,6 +276,8 @@
 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
 ('CCFLAGS_EXTRA', 'Extra C and C++ compiler flags', ''),
 ('LDFLAGS_EXTRA', 'Extra linker flags', ''),
+('MARSHAL_CCFLAGS_EXTRA', 'Extra C and C++ marshal compiler  
flags', ''),

+('MARSHAL_LDFLAGS_EXTRA', 'Extra marshal linker flags', ''),
 ('PYTHON_CONFIG', 'Python config binary to use',
  [ 'python2.7-config', 'python-config', 'python3-config' ]),
 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
@@ -734,7 +736,9 @@

 main.Prepend(CPPPATH=Dir('ext/pybind11/include/'))
 # Bare minimum environment that only includes python
-base_py_env = main.Clone()
+marshal_env = main.Clone()
+marshal_env.Append(CCFLAGS='$MARSHAL_CCFLAGS_EXTRA')
+marshal_env.Append(LINKFLAGS='$MARSHAL_LDFLAGS_EXTRA')

 # On Solaris you need to use libsocket for socket ops
 if not  
conf.CheckLibWithHeader(None, 'sys/socket.h', 'C++', 'accept(0,0,0);'):

@@ -1285,7 +1289,7 @@
 # to the configured variables.  It returns a list of environments,
 # one for each variant build (debug, opt, etc.)
 SConscript('src/SConscript', variant_dir=variant_path,
-   exports=['env', 'base_py_env'])
+   exports=['env', 'marshal_env'])

 # base help text
 Help('''
diff --git a/src/SConscript b/src/SConscript
index 7cd628a..aa233c8 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1140,7 +1140,7 @@
 # Build a small helper that marshals the Python code using the same
 # version of Python as gem5. This is in an unorthodox location to
 # avoid building it for every variant.
-py_marshal = base_py_env.Program('marshal', 'python/marshal.cc')[0]
+py_marshal = marshal_env.Program('marshal', 'python/marshal.cc')[0]

 # Embed python files.  All .py files that have been indicated by a
 # PySource() call in a SConscript need to be embedded into the M5
@@ -1196,7 +1196,7 @@
 code.write(str(target[0]))

 for source in PySource.all:
-base_py_env.Command(source.cpp, [ py_marshal, source.tnode ],
+marshal_env.Command(source.cpp, [ py_marshal, source.tnode ],
 MakeAction(embedPyFile, Transform("EMBED PY")))
 Source(source.cpp, tags=source.tags, add_tags='python')


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/30016
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3e420caa897059455ff8f35462db2b38da050e93
Gerrit-Change-Number: 30016
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s