blob: b446a2fe012cf2fe27f1c430a1bfb9768fc40512 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From 32e35a2f179d1b036d2eb699d77f869f7787f36b Mon Sep 17 00:00:00 2001
2From: Adrian Herrera <adrian.herrera@arm.com>
3Date: Tue, 8 Dec 2020 20:12:55 +0000
4Subject: [PATCH] util: m5ops, optional extra build flags
5
6This increases compilation control for users. Main use case is building
7m5ops as part of an image distribution. Specifying a different sysroot
8or dynamic linker may be required when the cross toolchain is built as
9part of the process.
10
11Change-Id: Icbd3faa92ea6e084fc4a9b2db83129bce73faf21
12Signed-off-by: Adrian Herrera <adrian.herrera@arm.com>
13Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38416
14Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
15Reviewed-by: Gabe Black <gabe.black@gmail.com>
16Maintainer: Jason Lowe-Power <power.jg@gmail.com>
17Tested-by: kokoro <noreply+kokoro@google.com>
18
19Upstream-Status: Accepted [https://gem5-review.googlesource.com/c/public/gem5/+/38416]
20Expected version: v20.2
21---
22 util/m5/SConstruct | 14 +++++++++++---
23 1 file changed, 11 insertions(+), 3 deletions(-)
24
25diff --git a/util/m5/SConstruct b/util/m5/SConstruct
26index bbae8d9bbf..a37573d763 100644
27--- a/util/m5/SConstruct
28+++ b/util/m5/SConstruct
29@@ -136,16 +136,24 @@ for root, dirs, files in os.walk(abspath(src_dir)):
30 #
31 # This also considers scons command line settings which may look like
32 # environment variables, but are set after "scons" on the command line.
33- def get_abi_opt(name, default):
34+ def _extract_abi_opt_val(name, default):
35 var_name = env.subst('${ABI}.%s' % name)
36- env[name] = os.environ.get(
37- var_name, ARGUMENTS.get(var_name, default))
38+ return os.environ.get(var_name, ARGUMENTS.get(var_name, default))
39+ def get_abi_opt(name, default):
40+ env[name] = _extract_abi_opt_val(name, default)
41+ def append_abi_opt(name):
42+ env.Append(**{ name: _extract_abi_opt_val(name, '') })
43
44 # Process the ABI's settings in the SConsopts file, storing them
45 # in a copy of the primary environment.
46 env.SConscript(Dir(root).File('SConsopts'),
47 exports=[ 'env', 'get_abi_opt' ])
48
49+ # The user can pass extra build flags for each ABI
50+ append_abi_opt('CCFLAGS')
51+ append_abi_opt('CXXFLAGS')
52+ append_abi_opt('LINKFLAGS')
53+
54 # Once all the options have been configured, set up build targets for
55 # this abi.
56 abi_dir = build_dir.Dir(env.subst('${ABI}'))
57--
582.17.1
59