diff --git a/build b/build index 555e790..4ded0d3 100755 --- a/build +++ b/build @@ -201,6 +201,7 @@ so looping over all of them would waste time. 'libpng-dev', 'libprotobuf-dev', 'libprotoc-dev', + 'lld', 'm4', 'protobuf-compiler', 'python-is-python3', diff --git a/build-gem5 b/build-gem5 index 3f17f76..c7105bf 100755 --- a/build-gem5 +++ b/build-gem5 @@ -33,6 +33,7 @@ Build and run all the gem5 unit tests instead of the gem5 executable. https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-tests ''' ) + self._add_argument('--ldflags') self._add_argument('extra_make_args') def build(self): @@ -108,15 +109,10 @@ https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-t 'CC': 'clang', 'CXX': 'clang++', } - gold_linker_cmd = [] else: extra_env = {} - if self.env['gem5_build_type'] == 'debug': - # A debug build is pointless if I can't... debug! - # https://github.com/cirosantilli/linux-kernel-module-cheat/issues/109 - gold_linker_cmd = [] - else: - gold_linker_cmd = ['--gold-linker', LF] + # https://cirosantilli.com/cirodown#benchmark-gem5-single-file-change-rebuild-time + ldflags_extra = ['-fuse-ld=lld'] + self.env['ldflags'] kwargs = {} if self.env['ccache']: kwargs['extra_paths'] = [self.env['ccache_dir']] @@ -126,9 +122,9 @@ https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-t 'scons', LF, '-j', str(self.env['nproc']), LF, '--ignore-style', LF, + 'LDFLAGS_EXTRA={}'.format(self.sh.cmd_to_string(ldflags_extra, force_oneline=True)), LF, 'USE_HDF5=1', LF, ] + - gold_linker_cmd + verbose + [ # TODO reenable, broken, had enough of this. diff --git a/common.py b/common.py index 12df835..fc40263 100644 --- a/common.py +++ b/common.py @@ -1747,6 +1747,12 @@ class BuildCliFunction(LkmcCliFunction): 'default': '', 'help': '''\ Pass the given compiler flags to all languages (C, C++, Fortran, etc.) +''', + }, + '--ldflags': { + 'default': '', + 'help': '''\ +Extra linker flags. ''', }, '--configure': {