diff --git a/README.adoc b/README.adoc index 812e248..52c8f53 100644 --- a/README.adoc +++ b/README.adoc @@ -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 diff --git a/build-gem5 b/build-gem5 index 442edc6..d052c29 100755 --- a/build-gem5 +++ b/build-gem5 @@ -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 diff --git a/common.py b/common.py index 0a68f7b..29842bb 100644 --- a/common.py +++ b/common.py @@ -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