build-gem5: --clang

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-01-25 00:00:03 +00:00
parent 7b99c45ac2
commit 72cd8f580d
3 changed files with 31 additions and 1 deletions

View File

@@ -10182,6 +10182,16 @@ This does not run the test however.
Note that the command and it's corresponding results don't need to show consecutively on stdout because tests are run in parallel. You just have to match them based on the class name `CircleBufTest` to the file `circlebuf.test.cpp`.
=== gem5 clang build
TODO test properly, benchmark vs GCC.
....
sudo apt-get install clang
./build-gem5 --clang
./run --clang --emulator gem5
....
== Buildroot
=== Introduction to Buildroot

View File

@@ -115,20 +115,30 @@ https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-t
targets = [self.env['gem5_unit_test_target']]
else:
targets = [self.env['gem5_executable']]
if self.env['clang']:
extra_env = {
'CC': 'clang',
'CXX': 'clang++',
}
gold_linker_cmd = []
else:
extra_env = {}
gold_linker_cmd = ['--gold-linker', LF,]
exit_status = self.sh.run_cmd(
(
[
'scons', LF,
'-j', str(self.env['nproc']), LF,
# '--gold-linker', LF,
'--ignore-style', LF,
] +
gold_linker_cmd +
verbose +
self.sh.add_newlines(targets) +
self.sh.add_newlines(self.env['extra_scons_args'])
),
cwd=self.env['gem5_source_dir'],
extra_paths=[self.env['ccache_dir']],
extra_env=extra_env,
raise_on_failure = False,
)
return exit_status

View File

@@ -158,6 +158,14 @@ CPU architecture to use. If given multiple times, run the action
for each arch sequentially in that order. If one of them fails, stop running.
Valid archs: {}
'''.format(arches_string)
)
self.add_argument(
'--clang',
default=False,
help='''\
Build with clang as much as possible. Set the build-id to clang by default unless
one is given explicitly. Currently supported components: gem5.
'''
)
self.add_argument(
'--dry-run',
@@ -437,6 +445,8 @@ Valid emulators: {}
if not env['_args_given']['gem5_build_id']:
if env['_args_given']['gem5_worktree']:
env['gem5_build_id'] = env['gem5_worktree']
elif env['_args_given']['clang']:
env['gem5_build_id'] = 'clang'
else:
env['gem5_build_id'] = consts['default_build_id']
env['is_arm'] = False