Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/51987 )
Change subject: scons: Fix linker flags for prof/perf builds.
......................................................................
scons: Fix linker flags for prof/perf builds.
SCons does not use a variable called LDFLAGS, it uses one called
LINKFLAGS. Switch some errant uses to the correct name.
Also, adjust all the other variable names to use LINK, for consistency
and to avoid confusion and avoid mistakes in the future.
Change-Id: I38d40f5231afdf62bcfba04478d403d65e9b1e26
---
M SConstruct
M src/SConscript
2 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/SConstruct b/SConstruct
index a151b44..18d24bc 100755
--- a/SConstruct
+++ b/SConstruct
@@ -248,8 +248,8 @@
('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
('CCFLAGS_EXTRA', 'Extra C and C++ compiler flags', ''),
('GEM5PY_CCFLAGS_EXTRA', 'Extra C and C++ gem5py compiler flags', ''),
- ('GEM5PY_LDFLAGS_EXTRA', 'Extra marshal gem5py flags', ''),
- ('LDFLAGS_EXTRA', 'Extra linker flags', ''),
+ ('GEM5PY_LINKFLAGS_EXTRA', 'Extra marshal gem5py flags', ''),
+ ('LINKFLAGS_EXTRA', 'Extra linker flags', ''),
('PYTHON_CONFIG', 'Python config binary to use',
[ 'python3-config', 'python-config']
),
@@ -304,7 +304,7 @@
# Initialize the Link-Time Optimization (LTO) flags
main['LTO_CCFLAGS'] = []
-main['LTO_LDFLAGS'] = []
+main['LTO_LINKFLAGS'] = []
# According to the readme, tcmalloc works best if the compiler doesn't
# assume that we're using the builtin malloc and friends. These flags
@@ -386,7 +386,7 @@
warning('"make" not found, link time optimization will be '
'single threaded.')
- for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
+ for var in 'LTO_CCFLAGS', 'LTO_LINKFLAGS':
# Use the same amount of jobs for LTO as we are running scons
with.
main[var] = ['-flto%s' % parallelism]
@@ -400,7 +400,7 @@
# Set the Link-Time Optimization (LTO) flags if enabled.
if GetOption('with_lto'):
- for var in 'LTO_CCFLAGS', 'LTO_LDFLAGS':
+ for var in 'LTO_CCFLAGS', 'LTO_LINKFLAGS':
main[var] = ['-flto']
# clang has a few additional warnings that we disable.
@@ -537,7 +537,7 @@
# Bare minimum environment that only includes python
gem5py_env.Append(CCFLAGS=['${GEM5PY_CCFLAGS_EXTRA}'])
-gem5py_env.Append(LINKFLAGS=['${GEM5PY_LDFLAGS_EXTRA}'])
+gem5py_env.Append(LINKFLAGS=['${GEM5PY_LINKFLAGS_EXTRA}'])
main['HAVE_PKG_CONFIG'] = main.Detect('pkg-config')
@@ -709,7 +709,7 @@
sticky_vars.Save(current_vars_file, env)
env.Append(CCFLAGS='$CCFLAGS_EXTRA')
- env.Append(LINKFLAGS='$LDFLAGS_EXTRA')
+ env.Append(LINKFLAGS='$LINKFLAGS_EXTRA')
exports=['env', 'gem5py_env']
diff --git a/src/SConscript b/src/SConscript
index 08c4504..068c5f9 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -835,10 +835,10 @@
envs['debug'].Append(CPPDEFINES=['DEBUG', 'TRACING_ON=1'])
envs['opt'].Append(CCFLAGS=['-g'], CPPDEFINES=['TRACING_ON=1'])
envs['fast'].Append(CPPDEFINES=['NDEBUG', 'TRACING_ON=0'])
-envs['prof'].Append(CCFLAGS=['-g', '-pg'], LDFLAGS=['-pg'],
+envs['prof'].Append(CCFLAGS=['-g', '-pg'], LINKFLAGS=['-pg'],
CPPDEFINES=['NDEBUG', 'TRACING_ON=0'])
envs['perf'].Append(CCFLAGS=['-g'], CPPDEFINES=['NDEBUG', 'TRACING_ON=0'],
- LDFLAGS=['-Wl,--no-as-needed', '-lprofiler', '-Wl,--as-needed'])
+ LINKFLAGS=['-Wl,--no-as-needed', '-lprofiler', '-Wl,--as-needed'])
# For Link Time Optimization, the optimisation flags used to compile
# individual files are decoupled from those used at link time
@@ -849,13 +849,13 @@
envs['debug'].Append(CCFLAGS=['-gstabs+'])
else:
envs['debug'].Append(CCFLAGS=['-ggdb3'])
- envs['debug'].Append(LDFLAGS=['-O0'])
+ envs['debug'].Append(LINKFLAGS=['-O0'])
# opt, fast, prof and perf all share the same cc flags, also add
- # the optimization to the ldflags as LTO defers the optimization
+ # the optimization to the linkflags as LTO defers the optimization
# to link time
for target in ['opt', 'fast', 'prof', 'perf']:
envs[target].Append(CCFLAGS=['-O3', '${LTO_CCFLAGS}'])
- envs[target].Append(LDFLAGS=['-O3', '${LTO_LDFLAGS}'])
+ envs[target].Append(LINKFLAGS=['-O3', '${LTO_LINKFLAGS}'])
elif env['CLANG']:
envs['debug'].Append(CCFLAGS=['-g', '-O0'])
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51987
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: I38d40f5231afdf62bcfba04478d403d65e9b1e26
Gerrit-Change-Number: 51987
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s